3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [1,2,3,4,13]; $nxt = $a[0]; $cnt = count($a); $j = 0; $ret = []; for ($i = 1; $i < $cnt; ++$i) { $pre = $nxt; $diff = $nxt; // ---- WAIT LIKE AGES FOR $a[$i] $nxt = $a[$i]; //$k = $a[$i + 1]; //$diff = $nxt - $pre; // MOV diff,nxt SUB diff,pre LATENCY: 2 //$diff = $pre - $nxt; $diff -= $nxt; $ret[$j++] = $pre; // branch if ($diff == -1) { // raising range do { ++$nxt; ++$i; } while ($a[$i] == $nxt); --$nxt; $ret[$j] = "$pre-$nxt";// . ($nxt - 1); } elseif ($diff == 1) { // found falling range ++$i; while ($a[$i] == --$nxt) { // search end of range ++$i; } $ret[$j] = "$pre-" . ($nxt + 1); $nxt = $a[$i]; } }
Output for git.master, git.master_jit, rfc.property-hooks

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:
74.42 ms | 401 KiB | 8 Q