Find all second level keys in multi-dimensional array in php
array_keys(call_user_func_array('array_merge', $a));
Merge all values and retrieve the resulting keys.
<?php
// Gets a list of all the 2nd-level keys in the array
function getL2Keys($array)
{
$result = array();
foreach($array as $sub) {
$result = array_merge($result, $sub);
}
return array_keys($result);
}
?>
edit: removed superfluous array_reverse() function