This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Arrays Forum

View Course » View Exercise

363 points
9a2fa8e0e50d81534df965c53ca9d94d?s=140&d=retro
Submitted by
erna221
almost 3 years ago

Do you mean use echo to output an item from $languages?

Hi there! Just noting that following the current instructions in exercise 6/7 of Arrays, the second task asks to use echo to output $languages. I think it's really asking to use echo to output an item from $languages.


4 votes

permalink

eventhough your code is correct, the interpreter gets messed up sometimes. Using this one,which is equal to yours in correctness may work !

    <?php
    $languages = array("HTML/CSS",
    "JavaScript", "PHP", "Python", "Ruby");
    $languages[1] = "oo"; 
    echo $languages[1];
  ?>

102 points
545118be8c1ccccbf2000354_262562232
Submitted by
Mohammad Jannaty
almost 3 years ago

1 Comment

54d7878fe39efe8c7a001863_756191777 MananC07 over 2 years ago

Thnxx IT Worked For Me


2 votes

permalink

Echo out the element that you changed and it should work

394 points
0dd41d3e7402309f615941369d8c28fc?s=140&d=retro
Submitted by
SpSea
almost 3 years ago


0 votes

permalink

I noticed this as well. The instructions state to output $languages, but that only returns the text "Array". This is unexpected and I suppose I'll figure out why it didn't print out the list in a future lesson.
I altered the code to "echo $language[1]" (1 being the list item I altered) and it output only the item that I changed and allowed me to pass the section.
I was under the impression that the requested result was to output all items in the array, but they do seem to just want the altered item.

1232 points
67101df9ef6947e3efd5d06f057d8c24?s=140&d=retro
Submitted by
Shelby Fried Rice
almost 3 years ago


0 votes

permalink

Same problem here. It was giving me a T-echo not expected error, so I checked the hint and seen that my code was perfectly fine. My code looked exactly like the code that was said to work above, but still broke and spit out an error. Strangely enough, I could submit it and I somehow passed the lesson.

149 points
D211e78375dae368865699f019ca88c0?s=140&d=retro
Submitted by
ethanwdp Price
almost 3 years ago