3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ [3, 8, 1, 7], [3, 8, 7, 7], [7, 9, 7, 8], [1, 2, 4, 1] ]; echo "input array: "; print_r($input); $sort_keys = $input[0]; asort($sort_keys); $sorted = array_map(function($row) use ($sort_keys){ foreach ($sort_keys as $key => $value) { $result[] = $row[$key]; } return $result; }, $input); echo "sorted array: "; print_r($sorted);
Output for git.master, git.master_jit, rfc.property-hooks
input array: Array ( [0] => Array ( [0] => 3 [1] => 8 [2] => 1 [3] => 7 ) [1] => Array ( [0] => 3 [1] => 8 [2] => 7 [3] => 7 ) [2] => Array ( [0] => 7 [1] => 9 [2] => 7 [3] => 8 ) [3] => Array ( [0] => 1 [1] => 2 [2] => 4 [3] => 1 ) ) sorted array: Array ( [0] => Array ( [0] => 1 [1] => 3 [2] => 7 [3] => 8 ) [1] => Array ( [0] => 7 [1] => 3 [2] => 7 [3] => 8 ) [2] => Array ( [0] => 7 [1] => 7 [2] => 8 [3] => 9 ) [3] => Array ( [0] => 4 [1] => 1 [2] => 1 [3] => 2 ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
60.56 ms | 403 KiB | 8 Q