3v4l.org

run code in 500+ PHP versions simultaneously
<?php class NumberInRange implements ValidatorRuleInterface { private string $format; private int $min; private int $max; private string $fieldName; public function __construct(int $min, int $max, string $fieldName) { $this->min = $min; $this->max = $max; $this->fieldName = $fieldName; $this->format = '%s не может быть больше $this->max и меньше $this->min.'; } public function __invoke(mixed $value): ?ValidationError { if (!is_int($value)) { throw new TypeException("Неправильный тип данных в аргументе функции."); } $resultMin = $value < $min; $resultMax = $value > $max; if ($resultMin || $resultMax) { $errorText = sprintf($this->format, $this->fieldName); 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.5.30.0110.00721.17
8.5.20.0100.00918.05
8.5.10.0110.00616.70
8.5.00.0140.00819.85
8.4.180.0100.01123.93
8.4.170.0100.01323.74
8.4.160.0140.01023.90
8.4.150.0080.00417.87
8.4.140.0170.00417.59
8.4.130.0090.01118.86
8.4.120.0100.00424.21
8.4.110.0110.00720.63
8.4.100.0110.00919.09
8.4.90.0100.01020.54
8.4.80.0120.00818.85
8.4.70.0110.00817.96
8.4.60.0100.01018.90
8.4.50.0070.01018.72
8.4.40.0100.01017.85
8.4.30.0040.01519.09
8.4.20.0130.00618.75
8.4.10.0050.00319.50
8.3.300.0140.00819.27
8.3.290.0080.01120.85
8.3.280.0110.01018.53
8.3.270.0120.01016.74
8.3.260.0130.00816.47
8.3.250.0110.00719.04
8.3.240.0130.00717.03
8.3.230.0050.00516.69
8.3.220.0050.00318.73
8.3.210.0100.00618.61
8.3.200.0040.00516.64
8.3.190.0110.00518.83
8.3.180.0120.00816.95
8.3.170.0040.00418.99
8.3.160.0110.00716.76
8.3.150.0090.01217.35
8.3.140.0080.00016.71
8.3.130.0090.00018.34
8.3.120.0070.01118.73
8.3.110.0160.00316.66
8.3.100.0170.00316.86
8.3.90.0120.00318.48
8.3.80.0060.00318.55
8.3.70.0060.01518.31
8.3.60.0110.00718.68
8.3.50.0190.00316.94
8.3.40.0070.00720.18
8.3.30.0090.00920.19
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0100.01028.09
8.2.300.0130.00818.10
8.2.290.0110.00820.37
8.2.280.0100.00918.28
8.2.270.0030.01517.38
8.2.260.0000.01816.72
8.2.250.0040.00416.61
8.2.240.0100.00616.73
8.2.230.0160.00320.94
8.2.220.0060.00924.06
8.2.210.0030.00626.77
8.2.200.0040.01118.42
8.2.190.0110.00716.63
8.2.180.0030.01225.92
8.2.170.0130.00718.99
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0090.00928.09
8.2.120.0120.00628.09
8.2.110.0100.01028.09
8.2.100.0140.00428.09
8.2.90.0130.00328.09
8.2.80.0200.00028.09
8.2.70.0150.00728.09
8.2.60.0190.00028.09
8.2.50.0090.00928.09
8.2.40.0120.00628.09
8.2.30.0110.00828.09
8.2.20.0130.00628.09
8.2.10.0070.01328.09
8.2.00.0130.00728.09
8.1.340.0110.00817.70
8.1.330.0080.01221.86
8.1.320.0130.00620.04
8.1.310.0070.01116.06
8.1.300.0060.00320.25
8.1.290.0100.00018.88
8.1.280.0110.00725.92
8.1.270.0030.00623.85
8.1.260.0140.00428.09
8.1.250.0090.00928.09
8.1.240.0160.00328.09
8.1.230.0120.00828.09
8.1.220.0150.00428.09
8.1.210.0070.01328.09
8.1.200.0130.00628.09
8.1.190.0110.00428.09
8.1.180.0120.00328.09
8.1.170.0040.01128.09
8.1.160.0040.00428.09
8.1.150.0040.00428.09
8.1.140.0100.00628.09
8.1.130.0100.00628.09
8.1.120.0040.01228.09
8.1.110.0030.00628.09
8.1.100.0060.00328.09
8.1.90.0090.00028.09
8.1.80.0060.00328.09
8.1.70.0000.00928.09
8.1.60.0060.00328.09
8.1.50.0080.00328.09
8.1.40.0090.00328.09
8.1.30.0030.00728.09
8.1.20.0090.00028.09
8.1.10.0060.00328.09
8.1.00.0040.00428.09

preferences:
43.34 ms | 994 KiB | 5 Q