3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iters = 500; $arr = range(0, 40_000); $t = microtime(true); foreach (range(0, $iters) as $i) { $arr = array_merge($arr, [$i => 'x']); } echo round((microtime(true) - $t) * 3, 3) . ' ms' . "\n"; $t = microtime(true); foreach (range(0, $iters) as $i) { $arr = [...$arr, $i => 'x']; } echo round((microtime(true) - $t) * 3, 3) . ' ms' . "\n"; $t = microtime(true); foreach (range(0, $iters) as $i) { $arr = [$i => 'x', ...$arr]; } echo round((microtime(true) - $t) * 3, 3) . ' ms' . "\n"; $t = microtime(true); foreach (range(0, $iters) as $i) { $arr[$i] = 'y'; } echo round((microtime(true) - $t) * 3, 3) . ' ms' . "\n"; var_dump(count($arr)); // dummy use of $arr variable
Output for git.master
0.127 ms 0.191 ms 3.024 ms 0 ms int(41503)
Output for git.master_jit
0.124 ms 0.128 ms 2.997 ms 0 ms int(41503)
Output for rfc.property-hooks
0.155 ms 0.156 ms 3.009 ms 0 ms int(41503)

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