note 80578 deleted from function.array-search by danbrown
| From: | danbrown@php.net | Date: | Wed, 29 Apr 2009 12:55:16 +0000 |
| Subject: | note 80578 deleted from function.array-search by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153968@lists.php.net to get a copy of this message | ||
Note Submitter: Fyorl
----
In response to <phpawe at aweawe dot cjb dot net>'s comments: Your function still uses
strtolower() inside a loop, a better example of a case-insensitive array search is the following:
<?php
function array_isearch($str, $array) {
foreach($array as $k => $v) {
if(strcasecmp($str, $v) == 0) return $k;
}
return false;
}
?>