Error msg - 'last element in array wasnt printed to the page


#1



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


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


<html>
  <head>
    <title>I am the King of Arrays!</title>
  </head>
  <body>
    <p>
      <?php
      // On the line below, create your own associative array:
 $myArray=array('jungle',10, 'brutal', 2, 'mean and creepy');

      // On the line below, output one of the values to the page:
    echo $myArray[4]; 
          
      // On the line below, loop through the array and output
      // *all* of the values to the page:
     $count=count($myArray);
     for ($i = 0; $i < $count; $i++) {
         echo $myArray[$i];
     }
     
      ?>
    </p>
  </body>


#2

Try this

<html>
  <head>
    <title>I am the King of Arrays!</title>
  </head>
  <body>
    <p>
      <?php
      // On the line below, create your own associative array:
 $myArray=array('jungle',10, 'brutal', 2, 'mean and creepy');

      // On the line below, output one of the values to the page:
    echo $myArray[4]; 
    echo " ";

      // On the line below, loop through the array and output
      // *all* of the values to the page:
     $count=count($myArray);
     for ($i = 0; $i < $count; $i++) {
         echo $myArray[$i];
         echo " ";
     }

      ?>
    </p>
  </body>
  </html>

if its not working then do this

<html>
>       <head>
>         <title>I am the King of Arrays!</title>
>       </head>
>       <body>
>         <p>
>           <?php
>           // On the line below, create your own associative array:
>      $myArray=array('jungle',10, 'brutal', 2, 'meanandcreepy');

>           // On the line below, output one of the values to the page:
>         echo $myArray[4]; 
>         echo " ";
>               
>           // On the line below, loop through the array and output
>           // *all* of the values to the page:
>          $count=count($myArray);
>          for ($i = 0; $i < $count; $i++) {
>              echo $myArray[$i];
>              echo " ";
>          }
>          
>           ?>
>         </p>
>       </body>
>       </html>

#3

It prints on the page when I try it. You could use some <br> and ' ' to make things prettier.

Can you post a screenshot showing the problem in action?