Skip to content

Instantly share code, notes, and snippets.

@sany2k8
Forked from ScrambledBits/get_array_key_multi.php
Created September 1, 2018 14:18
Show Gist options
  • Select an option

  • Save sany2k8/d1efd25f8a3ae4d223e59b5d758e4060 to your computer and use it in GitHub Desktop.

Select an option

Save sany2k8/d1efd25f8a3ae4d223e59b5d758e4060 to your computer and use it in GitHub Desktop.
<?php
function array_keys_multi(array $array)
{
$keys = array();
foreach ($array as $key => $value) {
$keys[] = $key;
if (is_array($array[$key])) {
$keys = array_merge($keys, array_keys_multi($array[$key]));
}
}
return $keys;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment