note 78801 modified in function.array-unique by levim
| From: | levim@php.net | Date: | Sun, 20 Dec 2015 05:47:59 +0000 |
| Subject: | note 78801 modified in function.array-unique by levim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204501@lists.php.net to get a copy of this message | ||
Case insensitive; will keep first encountered value.
<?php
function array_iunique($array) {
$lowered = array_map('strtolower', $array);
return array_intersect_key($array, array_unique($lowered));
}
?>
--was--
case insensitive
<?php
function array_iunique($array) {
return array_intersect_key($array,array_unique(
array_map(strtolower,$array)));
}
?>
http://php.net/manual/en/function.array-unique.php