3v4l.org

run code in 500+ PHP versions simultaneously
<?php $email = Email::create('TEST@fluentbe.com'); var_dump($email); readonly class Email { final protected function __construct( private string $value, ) { } public static function create(string $value): static { $data = static::recreate($value); $data->guard(); return $data; } public static function recreate(string $value): static { return new static($value); } public function getValue(): string { return $this->value; } public function equals(self $other): bool { return $this->getValue() === $other->getValue(); } protected function guard(): void { if (preg_match("/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_'+\-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/", $this->getValue()) !== 1) { throw new \InvalidArgumentException($this->getValue()); } } }

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.60.0050.00217.04
8.5.30.0100.01017.06
8.5.20.0260.00816.73
8.5.10.0320.00716.93
8.5.00.0080.01116.88
8.4.180.0100.01219.75
8.4.170.0320.00919.86
8.4.160.0290.01119.70
8.4.150.0290.01119.76
8.4.140.0360.00617.93
8.4.130.0340.00317.81
8.4.120.0380.00918.00
8.4.110.0360.00917.89
8.4.100.0220.00918.02
8.4.90.0390.00917.90
8.4.80.0400.00517.97
8.4.70.0390.00718.07
8.4.60.0380.00717.88
8.4.50.0360.00917.82
8.4.40.0340.01117.98
8.4.30.0310.01117.93
8.4.20.0390.00717.86
8.4.10.0390.00717.75
8.3.300.0320.00718.13
8.3.290.0300.00918.27
8.3.280.0400.00618.38
8.3.270.0350.00916.83
8.3.260.0410.00616.79
8.3.250.0380.00416.73
8.3.240.0360.00716.73
8.3.230.0280.01116.90
8.3.220.0270.00616.77
8.3.210.0170.00316.91
8.3.200.0280.00716.77
8.3.190.0340.00916.80
8.3.180.0320.00716.83
8.3.170.0350.01016.73
8.3.160.0390.00916.82
8.3.150.0180.00316.73
8.3.140.0190.00416.73
8.3.130.0200.00516.84
8.3.120.0150.00416.79
8.3.110.0150.00316.76
8.3.100.0170.00416.85
8.3.90.0200.00416.88
8.3.80.0170.00416.92
8.3.70.0180.00516.73
8.3.60.0210.00816.74
8.3.50.0330.00716.78
8.3.40.0360.00818.14
8.3.30.0280.00718.04
8.3.20.0300.01018.18
8.3.10.0260.00918.23
8.3.00.0270.00718.21

preferences:
48.21 ms | 707 KiB | 5 Q