3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'a' => 0, 'b' => 0, 'c' => 0, 'd' => 1, 'e' => 1, 'f' => 1 ]; $array = [1,0,0,0,0,1,1,0,0,0,0,0,0]; $counters = [0, 0]; $nths = []; foreach ($array as $v) { $nths[] = $counters[$v]++; } array_multisort($nths, $array, SORT_DESC); var_export($array);
Output for git.master_jit, git.master
array ( 0 => 1, 1 => 0, 2 => 1, 3 => 0, 4 => 1, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 12 => 0, )

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