<?php
$arr = [
"89098"=> "one",
"aaaa123" => "two",
"9" => "three",
5 => "four",
"7!?2,,--" => "five",
];
uksort($arr, function($a, $b){
return $a > $b;
});
var_dump($arr);
uksort($arr, function($a, $b){
$a = str_rot13($a);
$b = str_rot13($b);
return strcmp($a, $b);
});
var_dump($arr);
- Output for 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1 - 8.4.2
- Deprecated: uksort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /in/OTC4k on line 11
array(5) {
[5]=>
string(4) "four"
["7!?2,,--"]=>
string(4) "five"
[9]=>
string(5) "three"
[89098]=>
string(3) "one"
["aaaa123"]=>
string(3) "two"
}
array(5) {
[5]=>
string(4) "four"
["7!?2,,--"]=>
string(4) "five"
[89098]=>
string(3) "one"
[9]=>
string(5) "three"
["aaaa123"]=>
string(3) "two"
}
- Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.31
- Deprecated: uksort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /in/OTC4k on line 13
array(5) {
[5]=>
string(4) "four"
["7!?2,,--"]=>
string(4) "five"
[9]=>
string(5) "three"
[89098]=>
string(3) "one"
["aaaa123"]=>
string(3) "two"
}
array(5) {
[5]=>
string(4) "four"
["7!?2,,--"]=>
string(4) "five"
[89098]=>
string(3) "one"
[9]=>
string(5) "three"
["aaaa123"]=>
string(3) "two"
}
- Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
- array(5) {
["aaaa123"]=>
string(3) "two"
[5]=>
string(4) "four"
["7!?2,,--"]=>
string(4) "five"
[9]=>
string(5) "three"
[89098]=>
string(3) "one"
}
array(5) {
[5]=>
string(4) "four"
["7!?2,,--"]=>
string(4) "five"
[89098]=>
string(3) "one"
[9]=>
string(5) "three"
["aaaa123"]=>
string(3) "two"
}
preferences:
95.9 ms | 411 KiB | 5 Q