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.0070.01118.31
8.3.50.0110.00416.29
8.3.40.0070.01118.84
8.3.30.0110.00718.88
8.3.20.0100.00720.14
8.3.10.0000.00721.72
8.3.00.0030.00621.02
8.2.180.0100.00718.30
8.2.170.0140.00022.96
8.2.160.0070.00722.23
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0030.00622.10
8.2.120.0080.00026.35
8.2.110.0030.00620.26
8.2.100.0030.00917.91
8.2.90.0040.00419.27
8.2.80.0040.00417.97
8.2.70.0030.00517.63
8.2.60.0000.00918.16
8.2.50.0060.00318.10
8.2.40.0080.00022.15
8.2.30.0030.00719.24
8.2.20.0040.00417.96
8.2.10.0000.00818.24
8.2.00.0050.00218.20
8.1.280.0070.00725.92
8.1.270.0000.00823.87
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00422.14
8.1.230.0080.00322.13
8.1.220.0000.00817.79
8.1.210.0000.01018.77
8.1.200.0030.00617.35
8.1.190.0060.00317.23
8.1.180.0000.00818.10
8.1.170.0030.00518.63
8.1.160.0040.00419.04
8.1.150.0070.00018.84
8.1.140.0060.00319.48
8.1.130.0030.00318.84
8.1.120.0000.00717.41
8.1.110.0040.00417.49
8.1.100.0030.00617.46
8.1.90.0040.00417.54
8.1.80.0000.00717.42
8.1.70.0040.00417.48
8.1.60.0030.00617.67
8.1.50.0040.00417.49
8.1.40.0040.00417.46
8.1.30.0040.00417.73
8.1.20.0050.00317.71
8.1.10.0030.00517.63
8.1.00.0000.00817.57
8.0.300.0040.00418.77
8.0.290.0000.00816.72
8.0.280.0030.00318.48
8.0.270.0000.00817.14
8.0.260.0000.00916.79
8.0.250.0030.00317.07
8.0.240.0040.00416.98
8.0.230.0000.00817.09
8.0.220.0000.00717.00
8.0.210.0030.00317.05
8.0.200.0060.00017.01
8.0.190.0040.00417.06
8.0.180.0070.00016.93
8.0.170.0040.00417.03
8.0.160.0020.00516.86
8.0.150.0040.00417.00
8.0.140.0040.00417.00
8.0.130.0040.00513.52
8.0.120.0000.00817.05
8.0.110.0040.00417.01
8.0.100.0090.00016.99
8.0.90.0040.00416.85
8.0.80.0090.00916.93
8.0.70.0070.00017.00
8.0.60.0080.00017.09
8.0.50.0040.00417.07
8.0.30.0110.00517.15
8.0.20.0090.01117.40
8.0.10.0000.00716.89
8.0.00.0110.00816.79
7.4.330.0000.00515.55
7.4.320.0030.00316.55
7.4.300.0000.00716.63
7.4.290.0040.00416.53
7.4.280.0000.00816.51
7.4.270.0000.00716.56
7.4.260.0060.00013.32
7.4.250.0040.00416.41
7.4.240.0000.00816.69
7.4.230.0000.00716.53
7.4.220.0100.00716.38
7.4.210.0060.01316.53
7.4.200.0030.00316.34
7.4.160.0100.00516.60
7.4.150.0160.00417.40
7.4.140.0100.01017.86
7.4.130.0120.01016.57
7.4.120.0080.01316.54
7.4.110.0120.00616.61
7.4.100.0110.01216.69
7.4.90.0070.01016.53
7.4.80.0080.00819.39
7.4.70.0070.01016.78
7.4.60.0120.00616.58
7.4.50.0000.01416.46
7.4.40.0150.00316.52
7.4.30.0100.01016.59
7.4.10.0130.00614.91
7.4.00.0050.01115.13
7.3.330.0050.00013.29
7.3.320.0000.00613.45
7.3.310.0000.00716.48
7.3.300.0030.00316.47
7.3.290.0070.00716.40
7.3.280.0090.00716.43
7.3.270.0060.01317.40
7.3.260.0100.00916.51
7.3.250.0120.00916.46
7.3.240.0090.01016.54
7.3.230.0060.01216.52
7.3.210.0030.01316.61
7.3.200.0080.00816.51
7.3.190.0070.01016.56
7.3.180.0030.01316.46
7.3.170.0120.00316.43
7.3.160.0120.00916.63
7.3.130.0130.00314.76
7.3.120.0110.00614.87
7.3.110.0070.00714.61
7.3.100.0000.01514.74
7.3.90.0060.00914.95
7.3.80.0070.00714.85
7.3.70.0040.00814.82
7.3.60.0110.00414.60
7.3.50.0080.00314.96
7.3.40.0090.00914.86
7.3.30.0110.00714.66
7.3.20.0110.00716.77
7.3.10.0070.00716.48
7.3.00.0100.00716.64
7.2.330.0100.00716.70
7.2.320.0120.01116.59
7.2.310.0030.01416.85
7.2.300.0130.00316.57
7.2.290.0130.00316.70
7.2.260.0120.00614.96
7.2.250.0100.01015.25
7.2.240.0070.01015.01
7.2.230.0120.00615.04
7.2.220.0000.01515.20
7.2.210.0120.00315.09
7.2.200.0040.00815.03
7.2.190.0060.00914.91
7.2.180.0100.01015.24
7.2.170.0070.01015.20
7.2.160.0060.00915.04
7.2.150.0090.00616.72
7.2.140.0060.00316.94
7.2.130.0070.00716.77
7.2.120.0070.00516.90
7.2.110.0070.00516.98
7.2.100.0080.00816.92
7.2.90.0070.00916.87
7.2.80.0110.00816.81
7.2.70.0100.00716.86
7.2.60.0080.00616.91
7.2.50.0080.00516.94
7.2.40.0060.01116.84
7.2.30.0050.01116.88
7.2.20.0080.00916.91
7.2.10.0090.00716.94
7.2.00.0060.00616.82
7.1.330.0120.00315.83
7.1.320.0070.01015.85
7.1.310.0050.00515.90
7.1.300.0070.00715.60
7.1.290.0110.00815.88
7.1.280.0080.00815.98
7.1.270.0110.00415.93
7.1.260.0030.00615.63
7.1.250.0070.00715.81
7.1.240.0110.00315.85
7.1.230.0070.00715.79
7.1.220.0030.01015.83
7.1.210.0070.00715.93
7.1.200.0150.00615.77
7.1.190.0060.00815.91
7.1.180.0000.01115.73
7.1.170.0050.00515.71
7.1.160.0050.00315.77
7.1.150.0030.01015.87
7.1.140.0070.00715.61
7.1.130.0040.00415.92
7.1.120.0060.00615.71
7.1.110.0030.00615.67
7.1.100.0090.00615.45
7.1.90.0030.01115.82
7.1.80.0060.00915.88
7.1.70.0000.01016.64
7.1.60.0230.01624.42
7.1.50.0360.00624.40
7.1.40.0250.00924.22
7.1.30.0230.01124.25
7.1.20.0280.00924.18
7.1.10.0180.01415.25
7.1.00.0200.01115.43
7.0.330.0030.01515.43
7.0.320.0030.01015.58
7.0.310.0060.00615.43
7.0.300.0060.00615.34
7.0.290.0000.01115.43
7.0.280.0030.00815.13
7.0.270.0070.00415.46
7.0.260.0040.00415.46
7.0.250.0080.00015.37
7.0.240.0090.00315.19
7.0.230.0070.00415.40
7.0.220.0100.00015.29
7.0.210.0100.00315.33
7.0.200.0220.01115.01
7.0.190.0230.00515.10
7.0.180.0240.00414.82
7.0.170.0200.00714.96
7.0.160.0230.00814.99
7.0.150.0230.00715.12
7.0.140.0230.00714.88
7.0.130.0200.00815.30
7.0.120.0270.00615.17
7.0.110.0360.00715.01
7.0.100.0630.00814.88
7.0.90.0240.00715.08
7.0.80.0200.00714.91
7.0.70.0210.00614.96
7.0.60.0230.00814.90
7.0.50.0240.01114.96
7.0.40.0100.00314.16
7.0.30.0050.00614.09
7.0.20.0240.00714.18
7.0.10.0260.00714.11
7.0.00.0280.00314.11
5.6.400.0040.01213.92
5.6.390.0070.00713.98
5.6.380.0070.00714.11
5.6.370.0060.01014.18
5.6.360.0040.01114.10
5.6.350.0070.00714.15
5.6.340.0070.00713.91
5.6.330.0030.00713.75
5.6.320.0080.00514.05
5.6.310.0040.00414.07
5.6.300.0060.01214.36
5.6.290.0120.00614.25
5.6.280.0110.00413.96
5.6.270.0070.00313.91
5.6.260.0080.00513.87
5.6.250.0070.00714.16
5.6.240.0040.00414.33
5.6.230.0030.00713.90
5.6.220.0000.01413.93
5.6.210.0060.01014.04
5.6.200.0000.01514.19
5.6.190.0000.01314.18
5.6.180.0050.00514.28
5.6.170.0120.00314.17
5.6.160.0000.00813.93
5.6.150.0100.00014.10
5.6.140.0070.00314.19
5.6.130.0090.00614.11
5.6.120.0030.01014.20
5.6.110.0070.00414.28
5.6.100.0000.01314.30
5.6.90.0090.00614.13
5.6.80.0060.00613.97
5.6.70.0050.00313.89
5.6.60.0040.00714.04
5.6.50.0060.00614.05
5.6.40.0030.01313.95
5.6.30.0100.00313.98
5.6.20.0100.00713.81
5.6.10.0110.00713.85
5.6.00.0080.00813.93

preferences:
50 ms | 400 KiB | 5 Q