Get name of index in foreach
$array = array('first' => array(1, 3), 'second' => array(5,6), 'third' =>
array(8,4));
foreach($array as $a){
echo "key = " . key($a) . "\n";
};
How can i get name of index from this array? i would like receive:
key = first
key = second
key = third
but this return me in each case key = 0. Why? How can i get name of index?
codepad