3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr =array( array(1,22,3,6,3), array(4,16,2,10,1), array(11,2,3,5,9), array(3,8,12,4,8) ); function vhall_sort($arr){ $a=$new=array(); foreach($arr as $k=>$v){ $num=array_sum($v); $a[$k]=$num/count($v); } arsort($a); foreach ($a as $k=>$v){ $new[$k] = $arr[$k]; } return $new; } echo '<pre>'; print_r($arr); print_r(vhall_sort($arr));
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [0] => Array ( [0] => 1 [1] => 22 [2] => 3 [3] => 6 [4] => 3 ) [1] => Array ( [0] => 4 [1] => 16 [2] => 2 [3] => 10 [4] => 1 ) [2] => Array ( [0] => 11 [1] => 2 [2] => 3 [3] => 5 [4] => 9 ) [3] => Array ( [0] => 3 [1] => 8 [2] => 12 [3] => 4 [4] => 8 ) ) Array ( [0] => Array ( [0] => 1 [1] => 22 [2] => 3 [3] => 6 [4] => 3 ) [3] => Array ( [0] => 3 [1] => 8 [2] => 12 [3] => 4 [4] => 8 ) [1] => Array ( [0] => 4 [1] => 16 [2] => 2 [3] => 10 [4] => 1 ) [2] => Array ( [0] => 11 [1] => 2 [2] => 3 [3] => 5 [4] => 9 ) )

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:
41.97 ms | 403 KiB | 8 Q