note 106449 deleted from function.array-key-exists by crell
| From: | crell@php.net | Date: | Wed, 29 Jun 2022 20:46:15 +0000 |
| Subject: | note 106449 deleted from function.array-key-exists by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218774@lists.php.net to get a copy of this message | ||
Note Submitter: Rudi
----
I've got a new take on the multi key function I would like to share.
<?php
function array_multi_key_exists(array $arrNeedles, array $arrHaystack, $blnMatchAll=true){
$blnFound = array_key_exists(array_shift($arrNeedles), $arrHaystack);
if($blnFound && (count($arrNeedles) == 0 || !$blnMatchAll))
return true;
if(!$blnFound && count($arrNeedles) == 0 || $blnMatchAll)
return false;
return array_multi_key_exists($arrNeedles, $arrHaystack, $blnMatchAll);
}
?>
Hope you'll find it usefull.