3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 25, 12, 64, 22, 11]; for($i = 0; $i < count($arr); $i++) { $smallestIndex = $i; for ($j = $i + 1; $j < count($arr); $j++) { if($arr[$smallestIndex] < $arr[$j]) { $smallestIndex = $j; } } if($smallestIndex != $i ) { $temp = $arr[$i]; $arr[$i] = $arr[$smallestIndex]; $arr[$i+1] = $temp; } } print_r($arr);
Output for git.master_jit, git.master
Array ( [0] => 64 [1] => 64 [2] => 25 [3] => 22 [4] => 11 )

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:
29.49 ms | 405 KiB | 5 Q