3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = array("fourth", "first", "second", "third"); $indices = array(3, 0, 1, 2); $arrayToSort = array_combine($indices, $values ); sort($arrayToSort);

preferences:
37.9 ms | 402 KiB | 5 Q