3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['title' => 'foo', 'catid' => 1], ['title' => 'fi', 'catid' => 1], ['title' => 'bar', 'catid' => 2], ['title' => 'fum', 'catid' => 1], ['title' => 'blah', 'catid' => 3], ['title' => 'barn', 'catid' => 2], ['title' => 'bark', 'catid' => 2], ['title' => 'fa', 'catid' => 1], ]; $encounters = []; $catIds = []; foreach ($array as ['catid' => $v]) { $catIds[] = $v; $encounters[] = $e[$v] = ($e[$v] ?? 0) + 1; } array_multisort($encounters, $catIds, $array); var_export($array);
Output for git.master_jit, git.master
array ( 0 => array ( 'title' => 'foo', 'catid' => 1, ), 1 => array ( 'title' => 'bar', 'catid' => 2, ), 2 => array ( 'title' => 'blah', 'catid' => 3, ), 3 => array ( 'title' => 'fi', 'catid' => 1, ), 4 => array ( 'title' => 'barn', 'catid' => 2, ), 5 => array ( 'title' => 'fum', 'catid' => 1, ), 6 => array ( 'title' => 'bark', 'catid' => 2, ), 7 => array ( 'title' => 'fa', 'catid' => 1, ), )

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:
52.72 ms | 406 KiB | 5 Q