note 37449 deleted from function.in-array by didou

From: Date: Fri, 09 Jan 2004 17:13:13 +0000
Subject: note 37449 deleted from function.in-array by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-63218@lists.php.net to get a copy of this message
Note Submitter: duerra@nospam.yahoo.com ---- I was having frustrations with getting associative arrays to work with in_array, or any of the previous suggestions posted by users here, so I created my own version of in_array to search a given key in an associative array for a particular value: function in_multi_assoc_array($search, $array, $key) { foreach($array AS $tmpkey=>$tmpvalue) { if($tmpkey == $key) { if($tmpvalue == $tmpvalue) { return true; } } if(is_array($value)) { in_multi_assoc_array($search, $value, $key); } } return false; }

« previous php.notes (#63218) next »