php array_iunique case insensitive no latin values -
hello have string might include duplicate strings-words example "Το το" far have this:
function array_iunique($array) { return array_intersect_key($array,array_unique(array_map('mb_strtolower',$array))); }
when test string in english "to to" works great , outputs array 1 value, when try greek string mentioned above doesn't. missing here ?
expected result return 1 word , i'm interested in greek only.
for might have same issue solves issue:
function array_iunique($array) { return array_intersect_key( $array, array_unique( array_map( function($text) { return mb_strtolower($text, 'utf-8'); }, $array ) ) ); }
Comments
Post a Comment