Advanced arrays in PHP


#1

Please help me. I am receiving this error.

Oops, try again. Make sure to use bracket notation ([ ]) or curly brace notation ({ }) to access $myAssocArray in your code! Check out the Hint if you need help.

<?php
// This is an array using integers as the indices...
$myArray = array(2012, 'blue', 5, 'BMW');

    // ...and this is an associative array:
    $myAssocArray = array('year' => 2012,
                    'colour' => 'blue',
                    'doors' => 5,
                    'make' => 'BMW');
        
    // This code will output "blue".
    echo $myArray[1];
    echo '<br />';
        
    // Add your code here!
    $mycar= array(2009, 'dark blue', 4, 'Civics');
     $myAssocCar= array('year' => '2009', 'colour' => 'dark blue', 'doors' => 4, 'make' => 'Civics');
    echo $mycar[3];
    echo '</br/>';
    echo 'I have a ' . $myAssocCar['year'] . ' ' .
    $myAssocCar['make']. '.It is ' . $myAssocCar['colour']       . ' and has ' . $myAssocCar['doors']. 'door.';
  ?>

#2

Your are accessing elements from this array,$myAssocCar now lets take a look at the error message carefully again

pay close attention to the array they want you to access elements from and it will help you correct it


#3

this is sucks answer


#4

Thank you. I got it to work.