3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result= []; $names = ['TestAgent', 'TestAgent1', 'TestAgent1', 'TestAgent2', 'TestAgent2', 'TestAgent2']; $values = ['2019-04', '2019-05', '2019-06', '2019-04', '2019-05', '2019-06']; $counts = array_count_values($names); $offset = 0; foreach (array_values(array_unique($names)) as $key=>$name) { $slice = array_slice($values, $offset, $counts[$name]); $offset += count($slice); $result[$name] = $slice; } print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [TestAgent] => Array ( [0] => 2019-04 ) [TestAgent1] => Array ( [0] => 2019-05 [1] => 2019-06 ) [TestAgent2] => Array ( [0] => 2019-04 [1] => 2019-05 [2] => 2019-06 ) )

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