3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Filter { abstract public static function check($value, array $options = array()); } final class IntFilter extends Filter { public static function check($value, array $options = array()) { return $value; } } final class StringFilter extends Filter { public static function check($value, array $options = array()) { // Trim if (false !== ($options['trim'] ?? true)) { $value = trim($value); } $length = mb_strlen($value, '8bit'); // Empty if (false === ($options['empty'] ?? true)) { if (0 === $length) { throw new LengthException('chaine vide !'); } } // Min & max length if (isset($options['max'])) { $maxLength = IntFilter::check($options['max'], ['min' => 1]); if ($length > $maxLength) { throw new LengthException('trop long !'); } } if (isset($options['min'])) { $minLength = IntFilter::check($options['min'], ['min' => 1]); if ($length > $minLength) { throw new LengthException('trop court !'); } } return $value; } } var_dump(StringFilter::check(' test ', ['min' => 5]));

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.3.60.0090.00918.43
8.3.50.0040.01116.48
8.3.40.0070.01118.49
8.3.30.0070.00718.71
8.3.20.0070.01020.13
8.3.10.0000.00723.52
8.3.00.0000.00820.95
8.2.180.0070.01118.13
8.2.170.0070.00722.96
8.2.160.0030.01022.20
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00722.13
8.2.120.0040.00426.35
8.2.110.0030.00721.10
8.2.100.0090.00317.91
8.2.90.0030.00519.22
8.2.80.0000.00817.97
8.2.70.0040.00417.48
8.2.60.0030.00617.80
8.2.50.0040.00418.10
8.2.40.0030.00522.20
8.2.30.0060.00619.35
8.2.20.0040.00418.09
8.2.10.0040.00418.07
8.2.00.0040.00417.96
8.1.280.0040.01125.92
8.1.270.0000.00824.02
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00920.91
8.1.230.0090.00317.78
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0040.00417.23
8.1.190.0040.00417.23
8.1.180.0060.00318.10
8.1.170.0040.00418.56
8.1.160.0070.00018.95
8.1.150.0070.00018.86
8.1.140.0050.00619.55
8.1.130.0000.00818.78
8.1.120.0070.00017.33
8.1.110.0040.00417.49
8.1.100.0000.00817.46
8.1.90.0000.00717.31
8.1.80.0040.00417.48
8.1.70.0040.00417.44
8.1.60.0000.00817.68
8.1.50.0040.00417.60
8.1.40.0000.00717.51
8.1.30.0040.00417.75
8.1.20.0080.00017.68
8.1.10.0040.00417.67
8.1.00.0000.00817.57
8.0.300.0040.00418.77
8.0.290.0030.00516.75
8.0.280.0050.00318.48
8.0.270.0030.00317.30
8.0.260.0030.00516.76
8.0.250.0040.00417.05
8.0.240.0070.00017.05
8.0.230.0040.00416.98
8.0.220.0040.00316.82
8.0.210.0070.00016.81
8.0.200.0070.00017.00
8.0.190.0080.00016.98
8.0.180.0000.00816.91
8.0.170.0000.00716.88
8.0.160.0040.00416.93
8.0.150.0040.00416.91
8.0.140.0040.00416.78
8.0.130.0040.00413.32
8.0.120.0000.00816.90
8.0.110.0070.00016.75
8.0.100.0000.00716.78
8.0.90.0000.00716.76
8.0.80.0130.00316.88
8.0.70.0040.00416.88
8.0.60.0040.00416.88
8.0.50.0080.00016.79
8.0.30.0050.01016.91
8.0.20.0100.01117.40
8.0.10.0040.00417.02
8.0.00.0110.00716.88
7.4.330.0020.00215.55
7.4.320.0000.00716.51
7.4.300.0080.00016.64
7.4.290.0070.00016.66
7.4.280.0040.00416.61
7.4.270.0070.00016.53
7.4.260.0060.00013.34
7.4.250.0040.00416.59
7.4.240.0030.00516.45
7.4.230.0000.00716.45
7.4.220.0120.00416.63
7.4.210.0090.00616.58
7.4.200.0000.00716.68
7.4.160.0080.00916.65
7.4.150.0090.00917.40
7.4.140.0120.01117.86
7.4.130.0090.01516.59
7.4.120.0060.01216.48
7.4.110.0070.01116.56
7.4.100.0160.00316.45
7.4.90.0160.00016.53
7.4.80.0160.00719.39
7.4.70.0070.01016.53
7.4.60.0110.00516.46
7.4.50.0040.01116.43
7.4.40.0030.01416.57
7.4.30.0000.02016.65
7.4.00.0060.00615.08
7.3.330.0050.00013.38
7.3.320.0050.00013.19
7.3.310.0030.00316.37
7.3.300.0000.00716.32
7.3.290.0070.00816.38
7.3.280.0100.00616.38
7.3.270.0040.01217.40
7.3.260.0090.00916.45
7.3.250.0160.00416.39
7.3.240.0110.00616.57
7.3.230.0070.01316.32
7.3.210.0060.01816.45
7.3.200.0100.01316.51
7.3.190.0060.01116.29
7.3.180.0080.00816.43
7.3.170.0090.00616.59
7.3.160.0120.00916.46
7.3.120.0080.00414.70
7.3.110.0000.01814.88
7.3.100.0100.00314.57
7.3.90.0040.01114.96
7.3.80.0070.00314.82
7.3.70.0050.00214.87
7.3.60.0060.00614.87
7.3.50.0000.01415.00
7.3.40.0090.00314.55
7.3.30.0100.00314.70
7.3.20.0030.00616.46
7.3.10.0080.00816.68
7.3.00.0000.01116.85
7.2.330.0090.00916.87
7.2.320.0140.00716.87
7.2.310.0000.02116.84
7.2.300.0070.01016.71
7.2.290.0130.00316.64
7.2.240.0090.00514.95
7.2.230.0020.00814.67
7.2.220.0060.00314.74
7.2.210.0130.00315.24
7.2.200.0080.00514.82
7.2.190.0070.00714.81
7.2.180.0000.01014.88
7.2.170.0040.00814.75
7.2.160.0060.00315.22
7.2.150.0070.01016.54
7.2.140.0110.00616.78
7.2.130.0080.00416.99
7.2.120.0110.00416.71
7.2.110.0000.01416.44
7.2.100.0030.00916.55
7.2.90.0060.00616.98
7.2.80.0070.00716.93
7.2.70.0060.00916.62
7.2.60.0080.00516.82
7.2.50.0000.01716.68
7.2.40.0030.01216.93
7.2.30.0070.00417.10
7.2.20.0060.00616.64
7.2.10.0090.00616.96
7.2.00.0040.00918.16
7.1.330.0030.01315.70
7.1.320.0040.00815.80
7.1.310.0040.01115.39
7.1.300.0030.00715.80
7.1.290.0040.00715.91
7.1.280.0040.00815.92
7.1.270.0040.00715.35
7.1.260.0070.01015.67
7.1.250.0040.01415.71
7.1.200.0080.00415.80
7.1.100.0030.01018.04
7.1.70.0130.00317.20
7.1.60.0930.01033.45
7.1.50.0930.01333.08
7.1.40.0900.01032.75
7.1.30.1330.00732.68
7.1.20.0870.00732.73
7.1.10.0700.00714.83
7.1.00.0770.01015.06
7.0.200.1070.01314.86
7.0.190.0970.01014.91
7.0.180.0870.00714.38
7.0.170.1030.01014.63
7.0.160.0970.01014.43
7.0.150.0800.00714.27
7.0.140.0700.01314.71
7.0.130.0770.00714.70
7.0.120.0800.01014.94
7.0.110.0770.01314.62
7.0.100.1030.00714.67
7.0.90.0800.00714.72
7.0.80.0800.00714.56
7.0.70.0770.00714.48
7.0.60.0830.00714.20
7.0.50.0770.00714.63
7.0.40.1030.01014.71
7.0.30.1070.01014.65
7.0.20.0730.00714.69
7.0.10.1400.00314.61
7.0.00.1030.01014.57

preferences:
43.4 ms | 401 KiB | 5 Q