Skip to content

Instantly share code, notes, and snippets.

@allaire
Created August 2, 2012 00:53
Show Gist options
  • Save allaire/3232050 to your computer and use it in GitHub Desktop.
Save allaire/3232050 to your computer and use it in GitHub Desktop.
multi_array_key_exists
<?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