note 44817 added to function.in-array
| From: | mina86 at tlen dot pl | Date: | Tue, 17 Aug 2004 14:16:50 +0000 |
| Subject: | note 44817 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74815@lists.php.net to get a copy of this message | ||
A better (faster) version:
<?php
function in_array_ci($item, $array) {
$item = &strtoupper($item);
foreach($array as $element) {
if ($item == strtoupper($element)) {
return true;
}
}
return false;
}
?>
Noah B, set the 3rd argument to true and everything will wokr fine :) 0 == 'foo' is true,
however 0 === 'foo' is not.
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44817
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44817&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44817&report=yes
Search -- http://master.php.net/manage/user-notes.php