note 122461 deleted from function.array-key-exists by crell
| From: | crell@php.net | Date: | Wed, 29 Jun 2022 20:46:42 +0000 |
| Subject: | note 122461 deleted from function.array-key-exists by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218779@lists.php.net to get a copy of this message | ||
Note Submitter: Ellert van Koperen
----
Rudi's multidimensional array_key_exists function was not working for me, so i built one that
is.
Enjoy.
function array_multi_key_exists( $arrNeedles, $arrHaystack){
$Needle = array_shift($arrNeedles);
if(count($arrNeedles) == 0){
return(array_key_exists($Needle, $arrHaystack));
}else{
if(!array_key_exists($Needle, $arrHaystack)){
return false;
}else{
return array_multi_key_exists($arrNeedles, $arrHaystack[$Needle]);
}
}
}