note 44817 deleted from function.in-array by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 18:54:40 +0000 |
| Subject: | note 44817 deleted from function.in-array by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134476@lists.php.net to get a copy of this message | ||
Note Submitter: mina86 at tlen dot pl
----
A better (faster) version:
<?php
function in_array ($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.