3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $example = array( "ae1" => 1, "ae2" => 3, 0 => 3, 1 => 4, ); ksort($example); echo "Sort By Key:" . PHP_EOL; print_r($example); krsort($example); echo "Reverse Sort By Key:" . PHP_EOL; print_r($example);
based on g5G3T
Output for 7.0.0 - 7.3.0rc6
Sort By Key: Array ( [ae1] => 1 [ae2] => 3 [0] => 3 [1] => 4 ) Reverse Sort By Key: Array ( [1] => 4 [0] => 3 [ae2] => 3 [ae1] => 1 )
Output for 5.3.20 - 5.6.28
Sort By Key: Array ( [ae1] => 1 [0] => 3 [ae2] => 3 [1] => 4 ) Reverse Sort By Key: Array ( [1] => 4 [ae2] => 3 [0] => 3 [ae1] => 1 )