3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [0, 1, 2, 3, 4, 5, 6, 7]; $count = count($a); $span = 5; // most sensible with odd numbers $center = (int)($span / 2); foreach ($a as $i => $v) { printf( "%d: %s\n", $i, implode( ',', array_slice( $a, min($count - $span, max(0, $i - $center)), $span ) ) ); }
Output for git.master, git.master_jit, rfc.property-hooks
0: 0,1,2,3,4 1: 0,1,2,3,4 2: 0,1,2,3,4 3: 1,2,3,4,5 4: 2,3,4,5,6 5: 3,4,5,6,7 6: 3,4,5,6,7 7: 3,4,5,6,7

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