note 36110 deleted from function.array-search by dave

From: Date: Mon, 15 Dec 2003 19:16:42 +0000
Subject: note 36110 deleted from function.array-search by dave
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-62004@lists.php.net to get a copy of this message
Note Submitter: zitan@mediasculpt.net ---- Just a quick note: array_search finds sub strings in your arrays values i.e "sports" in "sports_template", which isn't always desirable. Here's a quick and dirty direct match function to solve this that I find useful :: <? function array_search_match($needle, $haystack){ $rkey = NULL; foreach($haystack as $key => $array){ foreach($array as $value){ if($value==$needle){ $rkey = $key; } } } return $rkey; } ?>

« previous php.notes (#62004) next »