note 69965 added to function.array-search

From: Date: Thu, 28 Sep 2006 09:48:56 +0000
Subject: note 69965 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-117764@lists.php.net to get a copy of this message
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. <? function myMulti_Array_Search($theNeedle, $theHaystack, $keyToSearch) { foreach($theHaystack as $theKey => $theValue) { $intCurrentKey = $theKey; if($theValue[$keyToSearch] == $theNeedle) { return $intCurrentKey ; } else { return 0; } } } ?> ---- Server IP: 85.116.0.130 Probable Submitter: 62.252.0.5 (proxied: 86.16.144.140) ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- https://master.php.net/note/edit/69965 Del: integrated -- https://master.php.net/note/delete/69965/integrated Del: useless -- https://master.php.net/note/delete/69965/useless Del: bad code -- https://master.php.net/note/delete/69965/bad+code Del: spam -- https://master.php.net/note/delete/69965/spam Del: non-english -- https://master.php.net/note/delete/69965/non-english Del: in docs -- https://master.php.net/note/delete/69965/in+docs Del: other reasons-- https://master.php.net/note/delete/69965 Reject -- https://master.php.net/note/reject/69965 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117764) next »