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.4.120.0100.01120.24
8.4.110.0090.01122.24
8.4.100.0090.01119.13
8.4.90.0040.00418.14
8.4.80.0050.00418.11
8.4.70.0130.00717.93
8.4.60.0160.00418.85
8.4.50.0120.00819.82
8.4.40.0040.01518.83
8.4.30.0060.01518.84
8.4.20.0140.00718.18
8.4.10.0090.00019.56
8.3.250.0090.01018.77
8.3.240.0110.00818.64
8.3.230.0070.00116.74
8.3.220.0050.00317.19
8.3.210.0150.00818.70
8.3.200.0060.00316.75
8.3.190.0100.00917.22
8.3.180.0110.00816.73
8.3.170.0120.00618.79
8.3.160.0110.00718.43
8.3.150.0060.00319.14
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.290.0160.00220.50
8.2.280.0110.00918.37
8.2.270.0110.00717.13
8.2.260.0040.01416.50
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.330.0130.00521.95
8.1.320.0110.00818.38
8.1.310.0030.00518.29
8.1.300.0060.00920.10

preferences:
26.28 ms | 403 KiB | 5 Q