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 '));

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.0150.00618.43
8.3.50.0100.00716.49
8.3.40.0040.01418.68
8.3.30.0140.00318.45
8.3.20.0000.00822.13
8.3.10.0080.00021.86
8.3.00.0000.00820.96
8.2.180.0060.01218.48
8.2.170.0110.00322.96
8.2.160.0110.00422.05
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00422.08
8.2.120.0080.00026.35
8.2.110.0090.00020.45
8.2.100.0090.00317.78
8.2.90.0000.00819.22
8.2.80.0080.00018.03
8.2.70.0000.00817.50
8.2.60.0080.00018.04
8.2.50.0050.00318.10
8.2.40.0040.00422.19
8.2.30.0070.00419.19
8.2.20.0000.00718.14
8.2.10.0060.00318.04
8.2.00.0000.00718.00
8.1.280.0160.00025.92
8.1.270.0090.00023.96
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0030.00722.62
8.1.230.0000.01019.08
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0000.00917.22
8.1.190.0040.00417.25
8.1.180.0000.00718.10
8.1.170.0040.00418.55
8.1.160.0030.00518.95
8.1.150.0000.00718.85
8.1.140.0030.00619.54
8.1.130.0050.00218.91
8.1.120.0070.00017.33
8.1.110.0040.00417.43
8.1.100.0000.00817.50
8.1.90.0070.00017.48
8.1.80.0050.00317.32
8.1.70.0030.00317.46
8.1.60.0060.00317.66
8.1.50.0070.00017.61
8.1.40.0040.00417.54
8.1.30.0040.00417.76
8.1.20.0000.00817.75
8.1.10.0000.00717.67
8.1.00.0000.00717.41
8.0.300.0070.00018.77
8.0.290.0000.00716.58
8.0.280.0000.00818.48
8.0.270.0040.00417.33
8.0.260.0030.00516.78
8.0.250.0000.00717.01
8.0.240.0070.00416.95
8.0.230.0080.00016.96
8.0.220.0000.00716.83
8.0.210.0030.00316.77
8.0.200.0040.00416.95
8.0.190.0090.00016.96
8.0.180.0000.00716.96
8.0.170.0040.00416.90
8.0.160.0040.00416.98
8.0.150.0000.00816.93
8.0.140.0040.00416.72
8.0.130.0060.00313.39
8.0.120.0040.00416.95
8.0.110.0040.00416.92
8.0.100.0040.00416.83
8.0.90.0050.00316.88
8.0.80.0090.00616.93
8.0.70.0040.00416.99
8.0.60.0070.00016.80
8.0.50.0050.00216.87
8.0.30.0110.00516.96
8.0.20.0100.00917.40
8.0.10.0030.00516.95
8.0.00.0110.00616.98
7.4.330.0050.00015.55
7.4.320.0040.00416.58
7.4.300.0070.00016.48
7.4.290.0030.00316.63
7.4.280.0000.00716.63
7.4.270.0000.00816.49
7.4.260.0000.00513.36
7.4.250.0070.00016.52
7.4.240.0050.00316.36
7.4.230.0030.00316.60
7.4.220.0080.00816.54
7.4.210.0030.01416.65
7.4.200.0000.00716.38
7.4.160.0100.00516.69
7.4.150.0070.01117.40
7.4.140.0090.01017.86
7.4.130.0170.00816.50
7.4.120.0130.00616.48
7.4.110.0120.00616.43
7.4.100.0160.00816.56
7.4.90.0140.00316.52
7.4.80.0060.01119.39
7.4.70.0100.00616.56
7.4.60.0030.01316.59
7.4.50.0130.00316.40
7.4.40.0140.00616.49
7.4.30.0070.01016.57
7.4.10.0060.01115.20
7.4.00.0080.00814.86
7.3.330.0050.00013.35
7.3.320.0000.00513.20
7.3.310.0030.00316.18
7.3.300.0000.00616.34
7.3.290.0110.00516.44
7.3.280.0090.00816.35
7.3.270.0090.00917.40
7.3.260.0100.01216.56
7.3.250.0090.01116.42
7.3.240.0120.00416.38
7.3.230.0080.00816.36
7.3.210.0070.01016.37
7.3.200.0130.00316.49
7.3.190.0100.00616.32
7.3.180.0060.01016.57
7.3.170.0060.00916.42
7.3.160.0160.00016.50
7.3.130.0000.01714.86
7.3.120.0070.01115.04
7.3.110.0100.01015.15
7.3.100.0090.00614.63
7.3.90.0040.01114.96
7.3.80.0030.00614.74
7.3.70.0070.00714.97
7.3.60.0060.00314.65
7.3.50.0000.01314.80
7.3.40.0030.00814.47
7.3.30.0040.01114.69
7.3.20.0110.00716.61
7.3.10.0000.01116.68
7.3.00.0030.00716.64
7.2.330.0100.00716.42
7.2.320.0130.01016.60
7.2.310.0100.00616.72
7.2.300.0090.01316.64
7.2.290.0120.00616.79
7.2.260.0110.00415.13
7.2.250.0110.00615.09
7.2.240.0040.01114.93
7.2.230.0030.01415.11
7.2.220.0070.00715.23
7.2.210.0070.00315.19
7.2.200.0070.00715.29
7.2.190.0040.00714.98
7.2.180.0030.00714.89
7.2.170.0060.00615.06
7.2.160.0040.00715.01
7.2.150.0060.00617.06
7.2.140.0090.00616.98
7.2.130.0040.01116.95
7.2.120.0030.00716.99
7.2.110.0040.00817.09
7.2.100.0060.00916.92
7.2.90.0040.01217.01
7.2.80.0030.00716.86
7.2.70.0060.00916.95
7.2.60.0050.00816.91
7.2.50.0070.01116.88
7.2.40.0060.00316.80
7.2.30.0100.00716.88
7.2.20.0080.00416.60
7.2.10.0070.01016.77
7.2.00.0040.00816.69
7.1.330.0150.00015.69
7.1.320.0110.00415.80
7.1.310.0030.00615.57
7.1.300.0070.00715.81
7.1.290.0080.00415.80
7.1.280.0080.00415.87
7.1.270.0040.01115.78
7.1.260.0030.00915.95
7.1.250.0030.01115.63
7.1.240.0130.00015.95
7.1.230.0030.01015.80
7.1.220.0070.01015.92
7.1.210.0030.01015.93
7.1.200.0030.01015.84
7.1.190.0030.00715.71
7.1.180.0060.00615.63
7.1.170.0060.00915.77
7.1.160.0040.00815.84
7.1.150.0040.01215.66
7.1.140.0050.00515.68
7.1.130.0070.00715.74
7.1.120.0060.00915.59
7.1.110.0100.00315.79
7.1.100.0000.01315.88
7.1.90.0070.00715.77
7.1.80.0040.01115.92
7.1.70.0030.00816.39
7.1.60.0450.01024.58
7.1.50.0420.01024.43
7.1.40.0380.00724.09
7.1.30.0400.00824.17
7.1.20.0400.00724.17
7.1.10.0300.00715.25
7.1.00.0330.00815.28
7.0.330.0060.00315.49
7.0.320.0040.00415.44
7.0.310.0070.00715.08
7.0.300.0080.00815.49
7.0.290.0060.00315.41
7.0.280.0040.00715.38
7.0.270.0030.01015.35
7.0.260.0040.01115.11
7.0.250.0070.00715.42
7.0.240.0040.00815.19
7.0.230.0070.00715.40
7.0.220.0030.00715.49
7.0.210.0060.00615.29
7.0.200.0680.01015.10
7.0.190.0510.00314.99
7.0.180.0330.01014.98
7.0.170.0550.01014.84
7.0.160.0330.00815.07
7.0.150.0300.01115.04
7.0.140.0370.01214.74
7.0.130.0370.00615.03
7.0.120.0340.00914.96
7.0.110.0330.01214.99
7.0.100.0300.00714.91
7.0.90.0480.00814.89
7.0.80.0340.01015.05
7.0.70.0270.01014.93
7.0.60.0350.00514.89
7.0.50.0330.00515.01
7.0.40.0300.00913.98
7.0.30.0300.00714.01
7.0.20.0280.00713.97
7.0.10.0290.01013.94
7.0.00.0300.00714.12
5.6.400.0090.00314.43
5.6.390.0040.00814.25
5.6.380.0030.01014.30
5.6.370.0030.00914.31
5.6.360.0100.00014.48
5.6.350.0030.01414.08
5.6.340.0090.00313.98
5.6.330.0070.00413.92
5.6.320.0000.00914.39
5.6.310.0110.00414.12
5.6.300.0040.01114.15
5.6.290.0060.00914.22
5.6.280.0090.00313.97
5.6.270.0000.01014.02
5.6.260.0070.00313.98
5.6.250.0070.00714.27
5.6.240.0060.00614.14
5.6.230.0090.00914.26
5.6.220.0040.00713.89
5.6.210.0030.00614.34
5.6.200.0030.01014.09
5.6.190.0060.00614.21
5.6.180.0040.01414.00
5.6.170.0030.00814.36
5.6.160.0070.01014.11
5.6.150.0070.00713.98
5.6.140.0060.00613.94
5.6.130.0090.00314.06
5.6.120.0100.00313.99
5.6.110.0100.00314.13
5.6.100.0110.00414.23
5.6.90.0060.01014.10
5.6.80.0000.00813.98
5.6.70.0040.01214.02
5.6.60.0000.01513.97
5.6.50.0030.01414.01
5.6.40.0070.00714.25
5.6.30.0120.00013.83
5.6.20.0040.00814.01
5.6.10.0060.00314.00
5.6.00.0100.00313.97

preferences:
37.91 ms | 400 KiB | 5 Q