In order to apply array_map with callback checking for localised values like city name, country name, you have to provide some sort of comparison array.
Here's an example of array_count_values for Polish city names. Just switch array_keys / array_values in order to obtain lowercase / uppercase.
$arr = array('Warsaw', 'Warsaw', 'Wrocław', 'Poznań', 'KrakÓw', 'waRsaw', 'Gdańsk', 'poznań', 'WROCŁAW', 'kraków', 'GDAŃSK');
$lowertoupperpolish = array(
'ą' => 'Ą',
'ć' => 'Ć',
'ę' => 'Ę',
'ł' => 'Ł',
'ń' => 'Ń',
'ó' => 'Ó',
'ś' => 'Ś',
'ż' => 'Ż',
'ź' => 'Ź',
);
function lowers($n) {
global $lowertoupperpolish;
return strtolower(str_replace(array_values($lowertoupperpolish), array_keys($lowertoupperpolish), $n));
}
$result = array_count_values(array_map('lowers', $arr));
print_r($result); ...prints:
Array ( [warsaw] => 3 [wrocław] => 2 [poznań] => 2 [kraków] => 2 [gdańsk] => 2 )