What am I missing? Creating my first array TASK


#1

This i what I wrote:

<?php
$friends = array("Misko", "Dusko", "Pisko", "Osko", "Sassko");
?>
And it just wont give me the pass to next lession.

I'm 99% that it is correct. I have put all "" and I have 5 elements?? What am I not able to see???


#2

refresh the page, reset the code and write it again

is creating the array all you have to do?


#3

tnx I did it.

I closed the page and returned after half an hour. Then I cleared 2 names and leave only 3 names and thenn I passed it. I'm sure that I tried with 3 names before. Probably some little bug or something.


#4

their is nothing wrong what you posted here,
the only thing is may be you did not saved it, when you reaload it. I just log in for time pass on this site, so i am not sure what you are trying to achieve, or may its part of any exercise,
But if you want to be sure just use print r command or var dumpt, your array is perfectly fine the way you created it, if you post your full code or link me to the exercise i may be able to help you out.


#5

Experiencing the same problem. Tried refreshing the page, changing the number of array elements from 3 to 4 but it throws the same error every-time.

Error message: > "Oops, try again. Did you remember to put at least three elements in your array? Make sure each one is a string in quotes!"


#6

I was experiencing the same problem until I used single quotes instead of double quotes. It worked.
I suggest you try this once.


#7

siblings = array ('Bea', 'George', 'hermione');

not sure what is wrong here? all we have to do is create an array?


#8

I have the same problem... The code seems to be good but the verification fails...


#9

Same problem here. Tried with 3 or 4 items, single or double quotes. Same result: > Oops, try again. Did you remember to put at least three elements in your array? Make sure each one is a string in quotes!

`
<?php
$friends = array('friend 1','friend 2','friend 3','friend 4');
?>


#10

Just tried it with only single names instead of "first last" and it worked. shrug


#11

I'm having the same problem and I'm also pretty sure my code is right. Here's what I have, similar to you.

<html>
  <head>
    <title>My First Array</title>
  </head>
  <body>
    <p>
      <?php
      
      $friends = array("Pizza", "Mac-n-Cheese", "Sleep", "Pie");
      echo $friends[1]
      
      ?>
    </p>
  </body>
</html>