3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class DemoFile { private Bar $foo; public function __construct(?Bar $foo = null) { $this->foo = $foo ?? new Bar(); } public function work(): void { echo $this->foo::class; } } class Bar {} (new DemoFile(null))->work(); final class DemoFile2 { public function __construct(private readonly ?Bar $foo = new Bar()) { } public function work(): void { echo $this->foo::class; } } (new DemoFile2(null))->work();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.30.0060.01217.46
8.5.20.0060.00216.72
8.4.180.0130.00821.73
8.4.170.0110.01119.81
8.4.90.0140.00618.09
8.3.300.0470.00818.05
8.3.180.0090.01016.84
8.3.50.0080.01116.88

preferences:
38.02 ms | 403 KiB | 5 Q