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

Arrays Forum

View Course » View Exercise

941 points
540fcac652f8632482000ab9_772896054
Submitted by
Tannim S (Umbreo)
about 3 years ago

Oops, try again. Did you create an array called $friends?

The above error keeps on appearing when I submit the code:
<?php
$friends = array("Qwerty", "Asdf", "Uiop");
?>

Does anyone have suggestions as to getting past this?


1 vote

permalink

your code is ok...just reload and try

768 points
52b5acf19c4e9d9f50001991_389654467
Submitted by
khalid92
about 3 years ago


0 votes

permalink

The same

157 points
Ca2dd6bdeb1178de2f552ac5469f7393?s=140&d=retro
Submitted by
uruchoss
about 3 years ago


0 votes

permalink

Reloaded 100 times - same problem...
print_r($friends) gives the result, so IDK....

633 points
5451ed9b8c1ccc494c000f21_24844280?awsaccesskeyid=akiajkz7qvqfd72xnj3q&expires=1513049594&signature=mxqmdfslvlvsdh73jmsxyzvt06w%3d
Submitted by
Anton Bogachov
about 3 years ago

1 Comment

52b5acf19c4e9d9f50001991_389654467 khalid92 about 3 years ago

send your code.


0 votes

permalink

This is kind of a different issue but I kept getting this error. Here is my code:

My First Array



<?php
$friends = array("do", "re", "The Fonze");
?>

I did the same thing you did. I refreshed a bunch of time. Then I logged out, deleted my cookies, and logged back in. Same error. I then entered "do","re","mi" in the array and it worked.

I then put the names in again and it failed. Turns out the space in "The Fonze" causes the error.

My First Array



<?php
$friends = array("do", "re", "TheFonze");
?>

This fixed the error.

1008 points
A4198b29f8d602e9b5091ce753039687?s=140&d=retro
Submitted by
Joseph Finch
almost 3 years ago


0 votes

permalink

The spaces in between ("Qwerty", "Asdf", "Uiop") might be causing the issue. try :("Qwerty","Asdf","Uiop")

63 points
97dbfe17e1e9421496ab58ddec60b725?s=140&d=retro
Submitted by
acidburn01
almost 3 years ago

1 Comment

19dbdb0d3dd325a55aeffda8132ac04d?s=140&d=retro bragon almost 3 years ago

Yeah, it was them, stupid spaces. Thanks :)


0 votes

permalink

I had the same problem and it only worked when I removed the break after the opening php tag. Codecademy can be funny sometimes.

So, this worked:

<?php $friends = array("do","re","mi");
?>

This didn't work:

<?php 
$friends = array("do","re","mi");
?>

505 points
1987d9104f8bbb153c745df835872312?s=140&d=retro
Submitted by
vr_gallagher
over 2 years ago