3v4l.org

run code in 300+ PHP versions simultaneously
<?php function acceptOne($a) {}; final class Foo { public $notTyped; public int $typed; } $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('assign not typed', function () { $foo = new Foo(); for ($i = 0; $i < 100_000; $i++) { $foo->notTyped = $i; $foo->notTyped = $i; $foo->notTyped = $i; $foo->notTyped = $i; $foo->notTyped = $i; } acceptOne($foo); }); $benchFx('assign typed', function () { $foo = new Foo(); for ($i = 0; $i < 100_000; $i++) { $foo->typed = $i; $foo->typed = $i; $foo->typed = $i; $foo->typed = $i; $foo->typed = $i; } acceptOne($foo); });
Output for git.master
assign not typed: 2.23 ms assign typed: 2.79 ms
Output for git.master_jit
assign not typed: 1.64 ms assign typed: 2.32 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:
33.45 ms | 406 KiB | 5 Q