Created
May 13, 2015 19:06
-
-
Save alekpopovic/78d5bac7c6800441aea7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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