note 88554 modified in function.in-array by thiago
| From: | thiago@php.net | Date: | Wed, 28 Jan 2009 21:40:53 +0000 |
| Subject: | note 88554 modified in function.in-array by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149916@lists.php.net to get a copy of this message | ||
Here's a simple little function I wrote that is a case insensitive version of in_array():
<?php
function in_arrayi( $needle, $haystack ) {
$found = false;
foreach( $haystack as $value ) {
if( strtolower( $value ) == strtolower( $needle ) ) {
$found = true;
}
}
return $found;
}
?>
--was--
Here's a simple little function I wrote that is a case insensitive version of in_array():
function in_arrayi( $needle, $haystack ) {
$found = false;
foreach( $haystack as $value ) {
if( strtolower( $value ) == strtolower( $needle ) ) {
$found = true;
}
}
return $found;
}
http://php.net/manual/en/function.in-array.php