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 ($options['max']) { $maxLength = IntFilter::check($options['max'], ['min' => 1]); if ($length > $maxLength) { throw new LengthException('trop long !'); } } if ($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.00018.55
8.3.50.0100.00716.60
8.3.40.0160.00618.54
8.3.30.0120.00318.53
8.3.20.0040.00420.27
8.3.10.0070.00021.91
8.3.00.0080.00020.76
8.2.180.0120.00318.41
8.2.170.0070.00722.96
8.2.160.0030.01022.13
8.2.150.0080.00024.18
8.2.140.0000.00724.66
8.2.130.0000.00722.09
8.2.120.0040.00426.35
8.2.110.0100.00021.00
8.2.100.0040.00717.73
8.2.90.0040.00419.05
8.2.80.0080.00017.97
8.2.70.0000.00817.63
8.2.60.0030.00518.04
8.2.50.0040.00418.10
8.2.40.0050.00322.26
8.2.30.0060.00619.13
8.2.20.0050.00318.04
8.2.10.0040.00417.99
8.2.00.0050.00218.14
8.1.280.0130.00325.92
8.1.270.0040.00423.79
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00619.53
8.1.230.0000.01119.23
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0070.00317.35
8.1.190.0000.00817.22
8.1.180.0040.00418.10
8.1.170.0060.00318.58
8.1.160.0080.00018.99
8.1.150.0000.00718.87
8.1.140.0070.00319.41
8.1.130.0000.00717.29
8.1.120.0000.00717.48
8.1.110.0080.00017.26
8.1.100.0000.00817.41
8.1.90.0050.00217.46
8.1.80.0040.00417.39
8.1.70.0030.00317.39
8.1.60.0080.00017.63
8.1.50.0080.00017.58
8.1.40.0040.00417.49
8.1.30.0040.00417.79
8.1.20.0030.00617.62
8.1.10.0030.00517.53
8.1.00.0080.00017.41
8.0.300.0040.00418.77
8.0.290.0060.00316.75
8.0.280.0000.00718.51
8.0.270.0040.00417.14
8.0.260.0000.00716.89
8.0.250.0030.00317.07
8.0.240.0040.00717.02
8.0.230.0000.00716.91
8.0.220.0050.00216.98
8.0.210.0030.00316.92
8.0.200.0000.00616.91
8.0.190.0030.00617.04
8.0.180.0050.00216.82
8.0.170.0080.00016.84
8.0.160.0000.00716.94
8.0.150.0040.00416.87
8.0.140.0040.00416.94
8.0.130.0000.00813.32
8.0.120.0000.00816.94
8.0.110.0050.00216.96
8.0.100.0040.00416.91
8.0.90.0000.00717.02
8.0.80.0090.00616.93
8.0.70.0000.00717.07
8.0.60.0030.00516.89
8.0.50.0040.00417.03
8.0.30.0090.00817.05
8.0.20.0110.00917.40
8.0.10.0040.00416.84
8.0.00.0050.01316.95
7.4.330.0050.00015.55
7.4.320.0000.00616.65
7.4.300.0000.00716.59
7.4.290.0000.00716.46
7.4.280.0030.00616.61
7.4.270.0000.00716.62
7.4.260.0000.00613.31
7.4.250.0000.00816.49
7.4.240.0030.00516.44
7.4.230.0000.00716.72
7.4.220.0090.00616.66
7.4.210.0130.00316.48
7.4.200.0080.00016.54
7.4.160.0090.00616.52
7.4.150.0140.00317.40
7.4.140.0140.00717.86
7.4.130.0150.00316.59
7.4.120.0080.01116.50
7.4.110.0110.00616.68
7.4.100.0060.01216.55
7.4.90.0130.00316.58
7.4.80.0110.00719.39
7.4.70.0110.00416.52
7.4.60.0080.00816.64
7.4.50.0090.00616.60
7.4.40.0130.00316.46
7.4.30.0180.00316.64
7.4.00.0040.00715.20
7.3.330.0050.00013.39
7.3.320.0000.00513.43
7.3.310.0030.00316.28
7.3.300.0030.00316.31
7.3.290.0060.01016.41
7.3.280.0080.00816.40
7.3.270.0180.00617.40
7.3.260.0080.00816.55
7.3.250.0140.00916.41
7.3.240.0070.01316.55
7.3.230.0040.01416.36
7.3.210.0280.02816.54
7.3.200.0070.01016.56
7.3.190.0070.01316.52
7.3.180.0090.00916.39
7.3.170.0090.00616.47
7.3.160.0080.00816.59
7.3.10.0150.00416.39
7.3.00.0100.00816.48
7.2.330.0030.01716.75
7.2.320.0060.01216.42
7.2.310.0070.01016.75
7.2.300.0070.01016.62
7.2.290.0030.01316.41
7.2.130.0100.00816.60
7.2.120.0080.00916.51
7.2.110.0090.00816.80
7.2.100.0140.00516.65
7.2.90.0090.00716.66
7.2.80.0100.00716.73
7.2.70.0100.00516.57
7.2.60.0050.00916.68
7.2.50.0110.00416.77
7.2.40.0080.00616.59
7.2.30.0100.00516.71
7.2.20.0090.00816.83
7.2.10.0080.00816.59
7.2.00.0090.00517.46
7.1.250.0090.00515.52
7.1.240.0070.00715.85
7.1.230.0040.00815.75
7.1.220.0000.00915.64
7.1.210.0040.01115.77
7.1.200.0090.00515.66
7.1.190.0060.00615.61
7.1.180.0080.00815.69
7.1.170.0100.01015.66
7.1.160.0040.01115.52
7.1.150.0120.00615.78
7.1.140.0130.00015.51
7.1.130.0030.01015.72
7.1.120.0070.00715.70
7.1.110.0000.01315.48
7.1.100.0070.00516.76
7.1.90.0000.01415.59
7.1.80.0060.00815.48
7.1.70.0110.00416.57
7.1.60.0070.01224.38
7.1.50.0450.01024.40
7.1.40.0400.00824.27
7.1.30.0190.00624.38
7.1.20.0400.00724.23
7.1.10.0380.00915.42
7.1.00.0040.01115.29
7.0.330.0070.00715.25
7.0.320.0000.01215.16
7.0.310.0030.01315.36
7.0.300.0000.01115.36
7.0.290.0030.00915.21
7.0.280.0070.01015.26
7.0.270.0060.00615.30
7.0.260.0030.01015.32
7.0.250.0030.01015.11
7.0.240.0030.00915.36
7.0.230.0230.00315.34
7.0.220.0130.00015.40
7.0.210.0130.01015.48
7.0.200.0450.01015.15
7.0.190.0080.00515.10
7.0.180.0050.00914.99
7.0.170.0050.00814.91
7.0.160.0370.00914.71
7.0.150.0300.01314.80
7.0.140.0510.01014.76
7.0.130.0050.00815.08
7.0.120.0080.00315.13
7.0.110.0320.01014.93
7.0.100.0450.00814.86
7.0.90.0550.00614.72
7.0.80.0370.01214.95
7.0.70.0320.01014.89
7.0.60.0310.01014.84
7.0.50.0510.00614.99
7.0.40.0550.00913.92
7.0.30.0300.01214.02
7.0.20.0390.00514.23
7.0.10.0330.00814.13
7.0.00.0370.01414.14
5.6.380.0100.00313.97

preferences:
48.95 ms | 401 KiB | 5 Q