note 96533 added to function.array-search

From: Date: Wed, 03 Mar 2010 18:58:22 +0000
Subject: note 96533 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-166634@lists.php.net to get a copy of this message
I needed a case insensitive array search function for a project... /** * Performs the same function as array_search except that it is case * insensitive * @param mixed $needle * @param array $haystack * @return mixed */ function array_nsearch($needle, array $haystack) { $it = new IteratorIterator(new ArrayIterator($haystack)); foreach($it as $key => $val) { if(strncmp($val,$needle) === 0) { return $key; } } return false; } ---- Server IP: 64.71.164.2 Probable Submitter: 70.99.89.86 ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- https://master.php.net/note/edit/96533 Del: integrated -- https://master.php.net/note/delete/96533/integrated Del: useless -- https://master.php.net/note/delete/96533/useless Del: bad code -- https://master.php.net/note/delete/96533/bad+code Del: spam -- https://master.php.net/note/delete/96533/spam Del: non-english -- https://master.php.net/note/delete/96533/non-english Del: in docs -- https://master.php.net/note/delete/96533/in+docs Del: other reasons-- https://master.php.net/note/delete/96533 Reject -- https://master.php.net/note/reject/96533 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#166634) next »