4.3 Creating your first array


#1



https://www.codecademy.com/courses/web-beginner-en-8a35h/0/3?curriculum_id=5124ef4c78d510dd89003eb8


I dont have friends.


Okay ... so I'm coding (as usual) and unfortunately im stucked on this exercise.
You want me to put names of my friends into the array.
But I dont have any friends. What can I do ? Should I find some friedns ?
Or just stop coding ? Im confused please help me :(


#2

Nobody is expecting us to name our friends, specifically. Just make up a list of names and use them.

    <p>
      <?php
          $friends = array("Scott", "Mike", "Neil");
      ?>
    </p>

The main objective is to learn how to write an array data structure using the correct syntax. Note the components.

$friends       => a variable name or descriptor with a leading $

    =          => assignment operator

 array         => array keyword

    ();        => parentheses followed by mandatory semi-colon

"Scott","Mike" => quoted string elements comma separated

#3

Oh thank you very much :slight_smile: You saved me :smiley:


#8