3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = range(1, 18); // You can either index by 0 and add one, or 1 and subtract one for($i = 1; $i <= count($data); $i++) { // Variable for easier reference later $item = $data[$i - 1]; // On the fifth item, emit logic for just one if(0 === $i % 5){ echo 'Single: ' . $item; }else { // Grab the next if it exsts $next = $data[$i++] ?? null; if($next){ echo 'Double: ' . $item . ', ' . $next; }else{ echo 'Double: ' . $item; } } echo PHP_EOL; }
Output for git.master
/bin/php-git-master: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-git-master) /bin/php-git-master: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-git-master)
Process exited with code 1.
Output for git.master_jit, rfc.property-hooks
Double: 1, 2 Double: 3, 4 Single: 5 Double: 6, 7 Double: 8, 9 Single: 10 Double: 11, 12 Double: 13, 14 Single: 15 Double: 16, 17 Double: 18

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:
66.01 ms | 407 KiB | 5 Q