3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Sample array $myArray = array( "apple" => 2, "orange" => 5, "banana" => 3, "kiwi" => 1, ); $specialKey = "banana"; $toparray[$specialKey] = $myArray[$specialKey]; unset($myArray[$specialKey]); ksort($myArray); print_r($toparray+$myArray);

preferences:
43.14 ms | 1116 KiB | 5 Q