Created
August 2, 2012 00:53
-
-
Save allaire/3232050 to your computer and use it in GitHub Desktop.
multi_array_key_exists
This file contains hidden or 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
<?php | |
function multi_array_key_exists($needle, $haystack) | |
{ | |
foreach ($haystack as $key => $value) | |
{ | |
if ($needle === $key) | |
{ | |
return $key; | |
} | |
if (is_array($value)) | |
{ | |
if(multi_array_key_exists($needle, $value)) | |
{ | |
return true; | |
} | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment