3v4l.org

run code in 200+ PHP versions simultaneously
<?php function partition(&$arr, $left, $right) { $pivot = $arr[($left + $right)/2]; while ($left <= $right) { while ($arr[$left] < $pivot) $left++; while ($arr[$right] > $pivot) $right--; if ($left <= $right) { $tmp = $arr[$left]; $arr[$left] = $arr[$right]; $arr[$right] = $tmp; $left++; $right--; } } return $left; } function quickSort($arr, $left = 0, $right = null) { if(!$right) $right = (count($arr)-1); $index = partition($arr, $left, $right); if ($left < $index - 1) { $arr = quickSort($arr, $left, $index - 1); } if ($index < $right) { $arr = quickSort($arr, $index, $right); } return $arr; } $sortMe = [8,11,10,13,4,12,56,9]; print_r(quickSort($sortMe));

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for branch php-master
Array ( [0] => 4 [1] => 8 [2] => 9 [3] => 10 [4] => 11 [5] => 12 [6] => 13 [7] => 56 )
Output for branch php-master+opcache
Array ( [0] => 4 [1] => 8 [2] => 9 [3] => 10 [4] => 11 [5] => 12 [6] => 13 [7] => 56 )
Output for branch php-master+jit
Array ( [0] => 4 [1] => 8 [2] => 9 [3] => 10 [4] => 11 [5] => 12 [6] => 13 [7] => 56 )
Output for Typed properties v2
Array ( [0] => 4 [1] => 8 [2] => 9 [3] => 10 [4] => 11 [5] => 12 [6] => 13 [7] => 56 )
Output for Arrow functions
Array ( [0] => 4 [1] => 8 [2] => 9 [3] => 10 [4] => 11 [5] => 12 [6] => 13 [7] => 56 )
Output for Object typehint
Array ( [0] => 4 [1] => 8 [2] => 9 [3] => 10 [4] => 11 [5] => 12 [6] => 13 [7] => 56 )
Output for Array change keys
Array ( [0] => 4 [1] => 8 [2] => 9 [3] => 10 [4] => 11 [5] => 12 [6] => 13 [7] => 56 )
Output for Lexical anon
Array ( [0] => 4 [1] => 8 [2] => 9 [3] => 10 [4] => 11 [5] => 12 [6] => 13 [7] => 56 )

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