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 )