3v4l.org

run code in 300+ PHP versions simultaneously
<?php class comparer { public static array $counter = []; public static function compare($a, $b) { static::$counter[$a] = (static::$counter[$a] ?? 0) + 1; static::$counter[$b] = (static::$counter[$b] ?? 0) + 1; return $a <=> $b; } } $a=[5,6,7,8,9,10,1,2,3,4]; uasort($a, 'comparer::compare'); var_dump(comparer::$counter);
Output for git.master_jit, git.master
array(10) { [5]=> int(5) [6]=> int(6) [7]=> int(2) [8]=> int(6) [9]=> int(2) [10]=> int(5) [1]=> int(5) [2]=> int(6) [3]=> int(6) [4]=> int(5) }

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