Assassins creed is printed to the page but apparently it hasn't. HELP


#1

https://www.codecademy.com/courses/web-beginner-en-QnQrd/0/7?curriculum_id=5124ef4c78d510dd89003eb8#

Oops, try again. It looks like 'AssasinsCreed' is part of $myArray, but it wasn't printed to the page!


       <?php
      // On the line below, create your own associative array:
      $myArray = array("Assasins Creed", "Mafia", "Call of Duty");

      // On the line below, output one of the values to the page:
     echo $myArray[1];      
     echo '<br />';
          
      // On the line below, loop through the array and output
      // *all* of the values to the page:
     foreach($myArray as $value) {
         echo "$value <br>";  
     }
      ?>


#2

Yours is not an associative array, but an ordered array. Following is an example of an associative array...

$myArray = array('Van'=>'Canucks','Calg'=>'Flames','Edm'=>'Oilers');

$key => $value

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.