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

Functions, Part I Forum

View Course » View Exercise

549 points
8d3a642acb3675443e38f77e2eb282a5?s=140&d=retro
Submitted by
Colmonkey
about 2 years ago

Is this a glitch? "Oops, try again. Did you remember to use array() in your code?"

After running my code, everything works, but I don't advance to the next level, it says:

Oops, try again. Did you remember to use array() in your code?

Here is my code(everything works fine from what I can see):

<?php
// Create an array and push 5 elements on to it, then 
// print the number of elements in your array to the screen
$names = array();
array_push($names, "George");
array_push($names, "Frank");
array_push($names, "Andy");
array_push($names, "Morgan");
array_push($names, "Kate");
print count($names);

?>

2 votes

permalink

It seems to be a bug with the type of browser you are using, try switching from whatever browser you are using to a different one, if that doesn't work I recommend looking at responses to your question in the Q&A section, I find the majority of my answers there even if I'm not the one asking the questions.

477 points
5177b4ff533b48c7480001e9_258355906
Submitted by
Tom
about 2 years ago


1 vote

permalink

I'm having the same problem. Help!

1327 points
549a215b93767655b100aaae_222939837
Submitted by
HERObrine
about 2 years ago

2 Comments

5539005551b8877474000301_461694885 athiyoka about 2 years ago

print this after you writen your five points //print 5 next to print count

8abf43e6951ad634381b1bbca0d3ce5f?s=140&d=retro Shapnam Afshar about 2 years ago

Try to refresh you page because I tryed it and it worked because i copied and pasted +Colmonkey code.


0 votes

permalink

I've tried chrome, firefox and even internet explorer shudders. Which browser have people had luck with? I am not pc so no safari for me.

1021 points
55722e32937676af980004b6_457385943
Submitted by
Brigette Eckert
almost 2 years ago


0 votes

permalink

I was having a problem like this, except my code was:

    <?php
    // Create an array and push 5 elements on to it, then 
// print the number of elements in your array to the screen
$friends = array();

array_push($friends, "Phlox");
array_push($friends, "Mathilde");
array_push($friends, "Eva");
array_push($friends, "Ellen");
array_push($friends, "Jos");

print count($friends);
    ?>

After I removed the empty line after $friends = array(); I passed the question. Maybe removing empty rules will help you guys too.

112 points
15dd1584a19a54fdd709105d397eecc4?s=140&d=retro
Submitted by
SomeMountain
over 1 year ago