note 88554 deleted from function.in-array by cmb
| From: | cmb@php.net | Date: | Mon, 21 Jan 2019 14:23:29 +0000 |
| Subject: | note 88554 deleted from function.in-array by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210091@lists.php.net to get a copy of this message | ||
Note Submitter: soxred93 at gmail dot com
----
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;
}
?>