3v4l.org

run code in 500+ PHP versions simultaneously
<?php $input = [ 'item-a' => 1, 'item-b' => 2, 'item-c' => 3, 'item-d' => 5, ]; $output = []; $c = 0; $prev = null; foreach($input as $name => $dist) { if($prev && $dist-$prev > 1) { ++$c; } $output[$c][] = $name; $prev = $dist; } var_dump($output);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(3) { [0]=> string(6) "item-a" [1]=> string(6) "item-b" [2]=> string(6) "item-c" } [1]=> array(1) { [0]=> string(6) "item-d" } }

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:
48.36 ms | 1404 KiB | 4 Q