3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = [ 'foo', 'foo', 'bar', 'baZ', 'baz', 'fÖo', 'foeo' ]; $collator = new Collator('de'); $collator->setStrength(Collator::PRIMARY); $arr2 = []; foreach ($arr as $v) { foreach ($arr2 as $v2) { if ($collator->compare($v, $v2) === 0) { continue 2; } } $arr2[] = $v; } var_dump($arr2);
based on bE3LQ
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
array(4) { [0]=> string(3) "foo" [1]=> string(3) "bar" [2]=> string(3) "baZ" [3]=> string(4) "foeo" }