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

Arrays Forum

View Course » View Exercise

277 points
01f2a56a956d18c5f9fe2efb7109bda8?s=140&d=retro
Submitted by
sinapurapu
over 2 years ago

Stuck at creating Array called freinds in PHP.

I am using this code:

<?php

 $freinds = array("X", "Y","Z");

  ?>

but it says that I need to create an array called freinds?

Please help.


2 votes

permalink

<?php
    // Add your array elements after
    // "Beans" and before the final ")"
     $friends= array("X", "Y","Z");

     print_r($friends);

459 points
Picture
Submitted by
David
over 2 years ago

1 Comment

566354cc937676913a000061_638238020 DAGIROV Djamal over 1 year ago

why do we need to add --> "print_r($friends);"


0 votes

permalink

sinapurapu

technically, you created correct code! yay :D

however, the exercise wants you to call the array friends, not freinds.

the checking simply does not recognize that your work is valid with the typo in it.
make this tiny adaptation and you should be fine.

565 points
979959283057c57a3f6d3e87c633b2b4?s=140&d=retro
Submitted by
jimhatesaccounts
over 2 years ago

2 Comments

01f2a56a956d18c5f9fe2efb7109bda8?s=140&d=retro sinapurapu over 2 years ago

thanks alot Jim, that worked. Yaaaaaay! I was stuck for days. :)

979959283057c57a3f6d3e87c633b2b4?s=140&d=retro jimhatesaccounts over 2 years ago

awesome! happy coding!


0 votes

permalink

yuo can try mine as follows: copy paste if you like:
<?php
$friends = array("do", "re", "mi");
?>

369 points
Fcee40eef8f2195b02c722ea14c80cf5?s=140&d=retro
Submitted by
thefracture
over 2 years ago

1 Comment

Bfa976391e9934e09f252d99fcf5e90e?s=140&d=retro DileepKumarMB over 2 years ago

It worked ........I am happy


0 votes

permalink

try inserting,
echo $friends;
in your html. works for me.

181 points
547eb4a88c1ccc9d12000d34_327246551
Submitted by
edwincyj
over 2 years ago