3 function sort_key_cmp(Collator
$c, string $a, string $b) {
4 $ka = $c->getSortKey($a);
5 $kb = $c->getSortKey($b);
8 } else if ($ka === $kb) {
17 function main_get_sort_key() {
19 array('1', '2', '10'),
28 foreach ($inputs as $input) {
29 foreach ($locales as $locale) {
30 $c = new Collator($locale);
31 usort(inout
$input, function($a, $b) use ($c) {
32 return sort_key_cmp($c, $a, $b);
34 var_dump(array($locale => $input));
35 $c->setAttribute(Collator
::NUMERIC_COLLATION
, Collator
::ON
);
36 usort(inout
$input, function($a, $b) use ($c) {
37 return sort_key_cmp($c, $a, $b);
39 var_dump(array($locale.' numeric' => $input));