note 75374 added to function.array-search
| From: | ben at reload dot me dot uk | Date: | Fri, 25 May 2007 18:50:07 +0000 |
| Subject: | note 75374 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126906@lists.php.net to get a copy of this message | ||
A refinement on chappy at citromail dot hu's case-insensitive search function...
<?php
function array_isearch($str,$array){
foreach ($array as $k=>$v) {
if (strtolower($v) == strtolower($str)) { return $v; };
};
return false;
}
?>
Shall return false on no match or return the first value that matches if one or more matches are
found (same functionality as the array_search() function). It is also more efficient as it stops
searching the array once a match is found.
----
Server IP: 194.145.210.4
Probable Submitter: 80.44.165.112
----
Manual Page -- http://www.php.net/manual/en/function.array-search.php
Edit -- https://master.php.net/note/edit/75374
Del: integrated -- https://master.php.net/note/delete/75374/integrated
Del: useless -- https://master.php.net/note/delete/75374/useless
Del: bad code -- https://master.php.net/note/delete/75374/bad+code
Del: spam -- https://master.php.net/note/delete/75374/spam
Del: non-english -- https://master.php.net/note/delete/75374/non-english
Del: in docs -- https://master.php.net/note/delete/75374/in+docs
Del: other reasons-- https://master.php.net/note/delete/75374
Reject -- https://master.php.net/note/reject/75374
Search -- https://master.php.net/manage/user-notes.php