7. Putting it All Together


I'm not sure what I'm doing wrong. Everything prints out in the result page properly but I get an error message reading:
"Oops, try again. It looks like 'Nissan=>Sentra' is part of $myArray, but it wasn't printed to the page!"

    <title>I am the King of Arrays!</title>
      // On the line below, create your own associative array:
        $myArray = array('Nissan'=>'Sentra', 'Toyota'=>'Corrola', 'Mazda'=>'Miata');

      // On the line below, output one of the values to the page:
        echo $myArray['Nissan'] . '<br/ >';
      // On the line below, loop through the array and output
      // *all* of the values to the page:
        foreach($myArray as $make=>$model) {
            echo $make . ' makes ' . $model . ' cars.' . '<br />';


Well I've found a fix through somebody else's post. Apparently, if you do a new line between each item in your array, that fixes it. Although I'm not sure why :confused:


It's probably something to do with their behind the scenes code that checks our work. And I had the same issue, can confirm this worked for me too.


Works with me too:
$myArray = array('Nissan'=>'Sentra',