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

Arrays Forum

View Course » View Exercise

1103 points
521c660babf821e8dc0002c0_410371118
Submitted by
Lucas Peterson
over 3 years ago

Doesn't work at all

It seriously does nothing when I hit 'Save and Submit Code'. It just stays at a non-moving gear.
Code:
<html>
<head>
<title>My First Array</title>
</head>
<body>
<p>
<?php
$friends = array ("do", "re", "mi");
?>
</p>
</body>
</html>


2 votes

permalink

Refresh the browser. then try again, keep refreshing until you get something besides a spinning gear.

76 points
Picture
Submitted by
Matt Bingham
over 3 years ago

10 Comments

52d56beb80ff330b7c00043c_832009853 Diyan Georgiev over 3 years ago

$friends = array("do", "re", "mi");

0c7a278cf26832d0295e7dbcf9dc58c3?s=140&d=retro Gianni Errera over 3 years ago

It doesn't work for me either, I not even refreshing the page, hence I'll just consider this lesson as passed.

0c7a278cf26832d0295e7dbcf9dc58c3?s=140&d=retro Gianni Errera over 3 years ago

Tried again and it worked eventually; apparently I shouldn't have put a space between two words whithin commas - e.g. "Peppa Pig" -, that prevents my code from working somehow.

Ae102e66957a579ff29c62745a8d211d?s=140&d=retro Ijem Ofili over 3 years ago

that's not good enough, there should be a valid logical reason why this is not working

58b88432ffd29a7e51aa69687c722924?s=140&d=retro Martin over 3 years ago

I had a name with a minus in it. When I removed it, it worked.

524838e8abf82174930038b4_774268263 Abu-Bakr over 3 years ago

finished it without refreshing?

87d30b8c67096251d400c6cd68ab7ea6?s=140&d=retro S. Alexander Zaman over 3 years ago

I had a name with a space in it that prevented mine from working

52da999728bf92d176a551f2d3fdc80c?s=140&d=retro jenelkcohen over 3 years ago

You have to declare your variable and you have a space between array and (

55afc4299113cbb4b900022b_774338531 Popcorn! about 3 years ago

You can't have a name with spaces or a minus in the array. I have no idea why, but it worked when I removed the spaces and minuses.

40b65a630d7ce51440895cf8d90ff9ec?s=140&d=retro alistaire about 3 years ago

Mine actually needed a space between "array" and the open parenthesis. sigh


1 vote

permalink

The instructions are unclear, but it will pass only after you echo the array in the html page. Add:

echo $friends;

2114 points
Picture
Submitted by
Kemel Zaidan
about 3 years ago

1 Comment

547eb4a88c1ccc9d12000d34_327246551 edwincyj over 2 years ago

this works for me. thank you.


1 vote

permalink

*

<html>
<head>
<title>My First Array</title>
</head>
<body>
<p>
<?php
$friends = array ("do", "re", "mi" ); // ad alternative space after "mi"
?>
</p>
</body>
</html>

*
You get correct answer by adding an space after third array item. Caused some grief but in the end I managed to stumble to a "correct" answer after few tries.

697 points
52ff94788c1ccce5410029e0_715125647
Submitted by
Mehto
almost 3 years ago


0 votes

permalink

Mine worked with

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

using spacees between the comas and the strings.

1461 points
52c816e49c4e9d8f54000e7d_949788089
Submitted by
Tiago
almost 3 years ago