3v4l.org

run code in 300+ PHP versions simultaneously
<?php readonly class Name implements Stringable { public function __construct( public string $value ) { if (strlen($value) === 0) { throw new ValueError("Name must be non-empty"); } } public function __toString(): string { return $this->value; } } readonly class User { public function __construct( public Name $name, // if we are receiving a Name instance, it just means that it's already a valid value! ) { } } $user1 = new User( new Name('Some valid name') ); echo $user1->name; // "Some valid name" $user2 = new User( new Name('') // kaboom );

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.3.140.0110.00420.75
8.3.130.0090.00618.46
8.3.120.0060.01220.84
8.3.110.0050.00316.75
8.3.100.0090.00016.87
8.3.90.0030.00716.82
8.3.70.0320.00518.26
8.3.50.0090.00016.88
8.2.250.0040.00718.45
8.2.240.0100.00618.64
8.2.230.0080.00020.94
8.2.220.0000.00818.58
8.2.210.0030.00616.57
8.2.110.0110.00822.09
8.1.300.0060.00920.10

preferences:
37.65 ms | 403 KiB | 5 Q