Hello I have string that might include duplicate strings-words for example "Το το" So far what I have is this:
function array_iunique($array) {
return array_intersect_key($array,array_unique(array_map('mb_strtolower',$array)));
}
When i test with a string in English like "To to" it works great and outputs an array with 1 value, but when I try it with the Greek string mentioned above it doesn't. What am I missing here ?
Expected result would be to return only 1 word and I'm interested in Greek only.
For anyone that might have the same issue this solves the issue:
function array_iunique($array) {
return array_intersect_key(
$array,
array_unique(
array_map(
function($text) {
return mb_strtolower($text, 'UTF-8');
},
$array
)
)
);
}