note 69965 deleted from function.array-search by levim

From: Date: Mon, 24 Feb 2014 22:40:59 +0000
Subject: note 69965 deleted from function.array-search by levim
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198647@lists.php.net to get a copy of this message
Note Submitter: Digitally Designed dot co dot uk ---- My Function to search a Multidimensional array. Pass in : $theNeedle as what you want to find. $theHaystack as the array $keyToSearch as what key in the array you want to find the value in. <?php function myMulti_Array_Search($theNeedle, $theHaystack, $keyToSearch) { foreach($theHaystack as $theKey => $theValue) { $intCurrentKey = $theKey; if($theValue[$keyToSearch] == $theNeedle) { return $intCurrentKey ; } else { return 0; } } } ?>

« previous php.notes (#198647) next »