Putting it all Together. Why doesn't this work?



My code behaves correctly and as intended.

    <title>I am the King of Arrays!</title>
      // On the line below, create your own associative array:
        $myArray = array("Name" => "Alex", "Age" => 19, "Religion" => "None");

      // On the line below, output one of the values to the page:
        echo $myArray['Name'];
      // On the line below, loop through the array and output
      // *all* of the values to the page:
     foreach($myArray as $k => $v)
         echo $k.": ".$v;


Did you try with lowercase key names?


Same result. The error I'm getting is "Oops, try again. It looks like 'name=>Alex' is part of $myArray, but it wasn't printed to the page!"

Not sure how it's getting that since everything is, indeed printed to the page..


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