Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alekpopovic/78d5bac7c6800441aea7 to your computer and use it in GitHub Desktop.
Save alekpopovic/78d5bac7c6800441aea7 to your computer and use it in GitHub Desktop.
function getArray($array, $index) {
if (!is_array($array)) return null;
if (isset($array[$index])) return $array[$index];
foreach ($array as $item) {
$return = getArray($item, $index);
if (!is_null($return)) {
return $return;
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment