note 64044 added to function.array-unique
| From: | sharif dot khan at gmail dot com | Date: | Thu, 06 Apr 2006 10:46:26 +0000 |
| Subject: | note 64044 added to function.array-unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107429@lists.php.net to get a copy of this message | ||
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:"
----
Server IP: 85.116.0.130
Probable Submitter: 82.163.189.70
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.array-unique.php
Edit -- http://master.php.net/note/edit/64044
Del: integrated -- http://master.php.net/note/delete/64044/integrated
Del: useless -- http://master.php.net/note/delete/64044/useless
Del: bad code -- http://master.php.net/note/delete/64044/bad+code
Del: spam -- http://master.php.net/note/delete/64044/spam
Del: non-english -- http://master.php.net/note/delete/64044/non-english
Del: in docs -- http://master.php.net/note/delete/64044/in+docs
Del: other reasons-- http://master.php.net/note/delete/64044
Reject -- http://master.php.net/note/reject/64044
Search -- http://master.php.net/manage/user-notes.php