3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 1 => "one", "two" => "two", 3.01 => "three", "4" => "four", false => "five", ]; krsort($arr, SORT_STRING); var_dump($arr);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Implicit conversion from float 3.01 to int loses precision in /in/mDad0 on line 6 array(5) { ["two"]=> string(3) "two" [4]=> string(4) "four" [3]=> string(5) "three" [1]=> string(3) "one" [0]=> string(4) "five" }
Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
array(5) { ["two"]=> string(3) "two" [4]=> string(4) "four" [3]=> string(5) "three" [1]=> string(3) "one" [0]=> string(4) "five" }

preferences:
143.38 ms | 403 KiB | 165 Q