3v4l.org

run code in 300+ PHP versions simultaneously
<?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.18, 8.3.0 - 8.3.6
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.27
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:
157.43 ms | 406 KiB | 218 Q