note 89256 added to function.in-array
| From: | KelvinJ at osu1 dot php dot net | Date: | Sat, 28 Feb 2009 13:04:52 +0000 |
| Subject: | note 89256 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151245@lists.php.net to get a copy of this message | ||
For a case-insensitive in_array(), you can use array_map() to avoid a foreach statement, e.g.:
<?php
function in_arrayi($needle, $haystack) {
return in_array(strtolower($needle), array_map('strtolower', $haystack));
}
?>
----
Server IP: 92.48.74.199
Probable Submitter: 90.193.155.57
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/89256
Del: integrated -- https://master.php.net/note/delete/89256/integrated
Del: useless -- https://master.php.net/note/delete/89256/useless
Del: bad code -- https://master.php.net/note/delete/89256/bad+code
Del: spam -- https://master.php.net/note/delete/89256/spam
Del: non-english -- https://master.php.net/note/delete/89256/non-english
Del: in docs -- https://master.php.net/note/delete/89256/in+docs
Del: other reasons-- https://master.php.net/note/delete/89256
Reject -- https://master.php.net/note/reject/89256
Search -- https://master.php.net/manage/user-notes.php