3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CorrectStructureValidator implements ValidatorRuleInterface { private string $format = 'Поле должно иметь следующий вид: %s. Вы написали - %s.'; private string $pattern; private string $verbalDescriptionOfPattern; public function __construct(string $pattern, string $verbalDescriptionOfPattern) { $this->pattern = $pattern; $this->verbalDescriptionOfPattern = $verbalDescriptionOfPattern; } public function __invoke(mixed $value): ?ValidationError { $result = preg_match($this->pattern, $value); if (!result) { $errorText = sprintf( $this->format, $this->verbalDescriptionOfPattern, $value ); return new ValidationError($errorText); } else { return null; } } }

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.01024.26
8.4.110.0120.00923.52
8.4.100.0050.00518.83
8.4.90.0110.01018.91
8.4.80.0120.00717.96
8.4.70.0060.00317.99
8.4.60.0120.00918.33
8.4.50.0130.00717.93
8.4.40.0140.00617.65
8.4.30.0080.00018.82
8.4.20.0000.01918.96
8.4.10.0050.00319.36
8.3.250.0100.00918.96
8.3.240.0120.00720.51
8.3.230.0120.00817.06
8.3.220.0040.00318.80
8.3.210.0120.00716.76
8.3.200.0100.00916.85
8.3.190.0060.00516.83
8.3.180.0080.00316.84
8.3.170.0100.00720.82
8.3.160.0070.01116.85
8.3.150.0090.00917.18
8.3.140.0060.01216.68
8.3.130.0060.00316.63
8.3.120.0110.00720.86
8.3.110.0060.00320.94
8.3.100.0030.00616.65
8.3.90.0040.00426.77
8.3.80.0090.00017.97
8.3.70.0070.01016.75
8.3.60.0140.00718.31
8.3.50.0030.01116.92
8.3.40.0130.00620.28
8.3.30.0130.00720.19
8.3.20.0070.00024.18
8.3.10.0000.00824.66
8.3.00.0170.00328.09
8.2.290.0090.00920.23
8.2.280.0050.00418.72
8.2.270.0110.00717.28
8.2.260.0100.00316.82
8.2.250.0050.00318.43
8.2.240.0060.00317.30
8.2.230.0080.00022.58
8.2.220.0110.00424.06
8.2.210.0070.00726.77
8.2.200.0030.00616.50
8.2.190.0100.00716.70
8.2.180.0140.00316.50
8.2.170.0150.00718.83
8.2.160.0100.00322.96
8.2.150.0050.00325.66
8.2.140.0040.00424.66
8.2.130.0140.00428.09
8.2.120.0130.00628.09
8.2.110.0090.00928.09
8.2.100.0200.00028.09
8.2.90.0110.01128.09
8.2.80.0100.01028.09
8.2.70.0120.00328.09
8.2.60.0120.00328.09
8.2.50.0170.00328.09
8.2.40.0100.01028.09
8.2.30.0090.00628.09
8.2.20.0040.01128.09
8.2.10.0100.01028.09
8.2.00.0140.00728.09
8.1.330.0070.00521.75
8.1.320.0090.01016.09
8.1.310.0100.00618.37
8.1.300.0140.00318.41
8.1.290.0030.00630.84
8.1.280.0160.00625.92
8.1.270.0030.00623.90
8.1.260.0150.00328.09
8.1.250.0140.00428.09
8.1.240.0060.01228.09
8.1.230.0180.00428.09
8.1.220.0120.00328.09
8.1.210.0030.01228.09
8.1.200.0100.00628.09
8.1.190.0130.00728.09
8.1.180.0090.00628.09
8.1.170.0070.00728.09
8.1.160.0130.00328.09
8.1.150.0110.00428.09
8.1.140.0030.01328.09
8.1.130.0070.00728.09
8.1.120.0090.00028.09
8.1.110.0090.00628.09
8.1.100.0050.00328.09
8.1.90.0030.00528.09
8.1.80.0050.00328.09
8.1.70.0060.00328.09
8.1.60.0100.00028.09
8.1.50.0030.00628.09
8.1.40.0070.00328.09
8.1.30.0030.00628.09
8.1.20.0110.00428.09
8.1.10.0080.00028.09
8.1.00.0050.00528.09

preferences:
25.93 ms | 403 KiB | 5 Q