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()) { $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 '));

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.00618.27
8.3.50.0140.00316.48
8.3.40.0120.00318.84
8.3.30.0120.00618.67
8.3.20.0050.00220.39
8.3.10.0040.00421.85
8.3.00.0020.00520.90
8.2.180.0070.00718.54
8.2.170.0000.01422.96
8.2.160.0080.00622.17
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0000.00822.22
8.2.120.0080.00026.35
8.2.110.0000.00920.41
8.2.100.0040.00817.78
8.2.90.0000.00819.18
8.2.80.0030.00617.97
8.2.70.0060.00317.50
8.2.60.0030.00618.03
8.2.50.0060.00318.10
8.2.40.0040.00422.33
8.2.30.0110.00020.95
8.2.20.0050.00217.98
8.2.10.0040.00418.05
8.2.00.0000.00818.04
8.1.280.0130.00325.92
8.1.270.0040.00423.96
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00320.91
8.1.230.0090.00319.22
8.1.220.0040.00417.78
8.1.210.0000.00818.77
8.1.200.0030.00617.10
8.1.190.0030.00617.00
8.1.180.0040.00418.10
8.1.170.0040.00418.52
8.1.160.0040.00418.87
8.1.150.0040.00418.84
8.1.140.0070.00319.52
8.1.130.0000.00718.88
8.1.120.0000.00717.31
8.1.110.0020.00517.32
8.1.100.0060.00317.42
8.1.90.0000.00817.39
8.1.80.0050.00317.42
8.1.70.0070.00017.23
8.1.60.0040.00417.55
8.1.50.0040.00417.56
8.1.40.0000.00817.56
8.1.30.0050.00317.64
8.1.20.0040.00417.71
8.1.10.0040.00417.52
8.1.00.0080.00017.36
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0030.00318.45
8.0.270.0070.00017.27
8.0.260.0060.00016.89
8.0.250.0030.00316.93
8.0.240.0090.00316.83
8.0.230.0070.00017.00
8.0.220.0000.00816.96
8.0.210.0070.00016.89
8.0.200.0000.00716.93
8.0.190.0030.00516.99
8.0.180.0040.00416.82
8.0.170.0070.00016.90
8.0.160.0030.00416.91
8.0.150.0030.00316.74
8.0.140.0040.00416.89
8.0.130.0000.00813.34
8.0.120.0000.00716.75
8.0.110.0040.00416.88
8.0.100.0050.00317.02
8.0.90.0000.00716.97
8.0.80.0060.00916.86
8.0.70.0040.00416.94
8.0.60.0050.00216.79
8.0.50.0000.00816.93
8.0.30.0080.01117.06
8.0.20.0100.00917.40
8.0.10.0000.00716.91
8.0.00.0150.00416.53
7.4.330.0050.00015.55
7.4.320.0040.00416.60
7.4.300.0060.00016.51
7.4.290.0030.00316.52
7.4.280.0040.00416.55
7.4.270.0080.00016.50
7.4.260.0030.00513.27
7.4.250.0030.00316.37
7.4.240.0040.00416.60
7.4.230.0070.00016.42
7.4.220.0040.01216.52
7.4.210.0100.00616.71
7.4.200.0030.00316.35
7.4.160.0110.00816.62
7.4.150.0140.00317.40
7.4.140.0130.00717.86
7.4.130.0120.00816.63
7.4.120.0080.01116.53
7.4.110.0000.01716.57
7.4.100.0000.01716.63
7.4.90.0130.00316.63
7.4.80.0080.00819.39
7.4.70.0060.00916.45
7.4.60.0130.00316.41
7.4.50.0000.01016.23
7.4.40.0140.00316.43
7.4.30.0120.00916.67
7.4.00.0060.00614.91
7.3.330.0050.00013.32
7.3.320.0050.00013.18
7.3.310.0000.00716.23
7.3.300.0000.00716.37
7.3.290.0050.01016.38
7.3.280.0080.00916.36
7.3.270.0090.00917.40
7.3.260.0080.00816.31
7.3.250.0140.01116.51
7.3.240.0100.00716.43
7.3.230.0080.00816.27
7.3.210.0150.00316.41
7.3.200.0080.01216.45
7.3.190.0100.00616.24
7.3.180.0110.00616.36
7.3.170.0110.00716.46
7.3.160.0030.01216.26
7.3.10.0090.00616.89
7.3.00.0100.00616.57
7.2.330.0110.00716.64
7.2.320.0070.01016.40
7.2.310.0120.00616.83
7.2.300.0090.00916.39
7.2.290.0130.00316.76
7.2.130.0050.00916.79
7.2.120.0110.00616.88
7.2.110.0020.01116.86
7.2.100.0050.00916.98
7.2.90.0090.00517.09
7.2.80.0080.00417.10
7.2.70.0080.00816.85
7.2.60.0030.00717.02
7.2.50.0050.00817.01
7.2.40.0020.01316.87
7.2.30.0070.00816.85
7.2.20.0080.00517.02
7.2.10.0050.00716.79
7.2.00.0080.00616.88
7.1.250.0100.00915.80
7.1.240.0090.00615.88
7.1.230.0030.01015.74
7.1.220.0030.01015.46
7.1.210.0060.00615.92
7.1.200.0070.00315.74
7.1.190.0090.00015.71
7.1.180.0100.00315.78
7.1.170.0030.00915.68
7.1.160.0030.00615.92
7.1.150.0100.00315.88
7.1.140.0100.00015.71
7.1.130.0080.00415.76
7.1.120.0080.00415.70
7.1.110.0070.00416.02
7.1.100.0030.00715.50
7.1.90.0110.00415.82
7.1.80.0090.00615.73
7.1.70.0020.01016.33
7.1.60.0030.01216.62
7.1.50.0050.01116.50
7.1.40.0070.00916.14
7.1.30.0040.01216.10
7.1.20.0080.00816.17
7.1.10.0050.00516.15
7.1.00.0020.01016.30
7.0.330.0080.00015.33
7.0.320.0040.00815.34
7.0.310.0060.00615.10
7.0.300.0060.00315.41
7.0.290.0030.01015.42
7.0.280.0080.00415.09
7.0.270.0000.01015.04
7.0.260.0040.00715.50
7.0.250.0030.01015.57
7.0.240.0000.01015.42
7.0.230.0110.00415.48
7.0.220.0000.01515.08
7.0.210.0030.01015.44
7.0.200.0080.00515.99
7.0.190.0020.00815.94
7.0.180.0080.00715.77
7.0.170.0050.00715.72
7.0.160.0040.00715.92
7.0.150.0050.00815.80
7.0.140.0060.00615.90
7.0.130.0020.00915.83
7.0.120.0060.00515.93
7.0.110.0040.00615.83
7.0.100.0050.00715.94
7.0.90.0050.00315.81
7.0.80.0030.00915.97
7.0.70.0050.00715.77
7.0.60.0030.00715.64
7.0.50.0060.00515.90
7.0.40.0030.00614.24
7.0.30.0060.00514.31
7.0.20.0010.00714.16
7.0.10.0030.00614.24
7.0.00.0000.01114.25
5.6.380.0100.00314.11

preferences:
53.76 ms | 400 KiB | 5 Q