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

1158 points
Submitted by
almost 4 years ago

What's wrong here?

My code won't pass.

I get the following error message:

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

I have clearly used array() on line 6

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

    array_push($fruit, "Apple");
    array_push($fruit, "Banana");
    array_push($fruit, "Kiwi");
    array_push($fruit, "Grapes");
    array_push($fruit, "Oranges");

        echo count($fruit);

1 vote


looks good, i passed my exercise with this code,
but try it once in print instead of echo ?

84 points
Submitted by
almost 4 years ago

1 Comment

52586e25f10c602aab000f94_273456774 Cougar-UK almost 4 years ago

I actually think it's my browser. I'm having lots of issues in chrome, switched to IE (which I hate) and it passes

0 votes


You have to change :
$fruit = array();

into :
$fruit = array('');

and you will pass

620 points
Submitted by
almost 4 years ago

1 Comment

Cc295c27f59e7a8ecc853264009c03c2?s=140&d=retro melaniesazegar over 3 years ago

I did this and it worked. Then I tried it again without the '' and that worked too for some reason. Maybe it's a browser issue. Thanks for your help!

0 votes


Just backspace and replace a letter in the word 'array'. worked for me after i reloaded the page thrice

833 points
Submitted by
over 3 years ago