Accessing multidimensional array elements
<?
$meals = array('breakfast' => array('A','C'),
'lunch' => array('B', 'E'),
'snack' => array('C','F'));
$lunches = array( array('Chicken','Eggplant','Rice'),
array('Eggplant','Tofu'));
$flavors = array('Japanese' => array('hot' => '1',
'salty' => '2'),
'Chinese' => array('hot' => '3',
'pepper-salty' => '4'));
print $meals['lunch'][1];
print $meals['snack'][0];
print $lunches[0][0];
print $lunches[2][1];
print $flavors['Japanese']['salty']
print $flavors['Chinese']['hot'];
?>
Related examples in the same category