3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class StringWrapper { protected function __construct(readonly public string $value) {} abstract public static function parse(string $raw): self; } class Email extends StringWrapper { public static function parse(string $raw): self { str_contains($raw, '@') or throw new InvalidArgumentException(); return new self($raw); } } class User { public function __construct(readonly public Email $email) {} // Constructors should be strict, use factory methods for a friendly API public static function make(string|Email $email): self { $email instanceof Email or $email = Email::parse($email); return new self($email); } } $user = new User(Email::parse("dude@la.us")); $user = User::make("walter@la.us"); // $user = User::make("donnie"); // throws

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.0120.00422.23
8.4.110.0430.00917.81
8.4.100.0260.01017.62
8.4.90.0410.00817.65
8.4.80.0370.01117.72
8.4.70.0370.00917.65
8.4.60.0340.00517.69
8.4.50.0300.00817.69
8.4.40.0400.01117.54
8.4.30.0430.00917.67
8.4.20.0440.01017.44
8.4.10.0420.00917.49
8.3.250.0080.00817.16
8.3.240.0310.00816.50
8.3.230.0150.00716.58
8.3.220.0170.00516.54
8.3.210.0210.00316.68
8.3.200.0330.00916.47
8.3.190.0320.00816.64
8.3.180.0290.00616.59
8.3.170.0320.00616.35
8.3.160.0370.01016.48
8.3.150.0400.00716.55
8.3.140.0340.00716.42
8.3.130.0280.00616.62
8.3.120.0310.00516.36
8.3.110.0290.00916.34
8.3.100.0360.00716.46
8.3.90.0400.00916.50
8.3.80.0430.00816.44
8.3.70.0440.00516.54
8.3.60.0400.00716.39
8.3.50.0280.00716.69
8.3.40.0310.00417.46
8.3.30.0340.00517.48
8.3.20.0310.00817.60
8.3.10.0200.00617.63
8.3.00.0370.01017.63
8.2.290.0230.00816.53
8.2.280.0220.00616.48
8.2.270.0240.00716.44
8.2.260.0390.00816.40
8.2.250.0310.01016.41
8.2.240.0240.00616.35
8.2.230.0210.00416.34
8.2.220.0150.00416.38
8.2.210.0220.00716.38
8.2.200.0330.00916.35
8.2.190.0350.01016.36
8.2.180.0250.00816.63
8.2.170.0280.00717.71
8.2.160.0300.00617.64
8.2.150.0380.00517.68
8.2.140.0250.00717.64
8.2.130.0270.00717.72
8.2.120.0360.00917.54
8.2.110.0350.01017.59
8.2.100.0290.00717.53
8.2.90.0320.00717.42
8.2.80.0350.00917.51
8.2.70.0330.00417.64
8.2.60.0300.00617.64
8.2.50.0320.00817.64
8.2.40.0290.00517.48
8.2.30.0260.00717.38
8.2.20.0270.00817.38
8.2.10.0330.00917.32
8.2.00.0340.00817.51

preferences:
27.73 ms | 403 KiB | 5 Q