3v4l.org

run code in 300+ PHP versions simultaneously
<?php $benchFx = function (string $msg, \Closure $fx) { $times = []; for ($i = 0; $i < 10; $i++) { $t = microtime(true); $fx(); $t = microtime(true) - $t; $times[] = $t; } $bestTime = min($times); echo $msg . ': ' . round($bestTime * 1000, 2) . " ms\n"; }; $benchFx('append', function () { $arr = []; for ($i = 0; $i < 1_000; $i++) { $arr[] = 'x'; } }); $benchFx('array_push', function () { $arr = []; for ($i = 0; $i < 1_000; $i++) { array_push($arr, 'x'); } }); $benchFx('array_unshift', function () { $arr = []; for ($i = 0; $i < 1_000; $i++) { array_unshift($arr, 'x'); } });
Output for git.master_jit
append: 0.01 ms array_push: 0.02 ms array_unshift: 2.2 ms

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