Re: case-insensitive in_array()

From: Date: Thu, 23 Nov 2000 05:32:31 +0000
Subject: Re: case-insensitive in_array()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-26789@lists.php.net to get a copy of this message
On Thu, 23 Nov 2000, Gerald Kaszuba wrote: > Hi.. > > Current in_array() function: > bool in_array (mixed needle, array haystack) > > I want one that does this: > bool in_arrayi(string needle, array haystack) > > Don't tell me I need to do it the long way :P What's so bad about the long way? function in_arrayi($needle, $haystack) { $keys = array_keys($haystack); foreach ($keys as $key) { if (strtolower($key) == strtolower($needle)) return true; } return false; } Matt

« previous php.general (#26789) next »