note 64044 deleted from function.array-unique by nlopess
| From: | nlopess@php.net | Date: | Thu, 06 Apr 2006 16:40:46 +0000 |
| Subject: | note 64044 deleted from function.array-unique by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107457@lists.php.net to get a copy of this message | ||
Note Submitter: sharif dot khan at gmail dot com
----
i couldn't see an array function that removed unique values regardless of case so i wrote this
crude one. it needs work to optimize it but it works.
function array_unique_nocase($array) {
foreach($array as $key => $val) {
foreach($array as $key2 => $val2) {
if($key != $key2 && strtoupper($val) == strtoupper($val2)) {
unset($array[$key]);
}
}
}
return $array;
}
used successfully at http://www.iknow-devon.co.uk/all_devon/ on the
left after "Accommodation in:"