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 ', ['max' => 3]));

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.0110.01118.43
8.3.50.0080.00516.30
8.3.40.0000.01418.79
8.3.30.0140.00418.80
8.3.20.0040.00420.25
8.3.10.0000.00821.89
8.3.00.0040.00420.96
8.2.180.0070.01018.54
8.2.170.0110.00722.96
8.2.160.0100.00322.31
8.2.150.0060.00324.18
8.2.140.0070.00024.66
8.2.130.0050.00322.08
8.2.120.0000.00826.35
8.2.110.0040.00420.27
8.2.100.0060.00617.77
8.2.90.0000.00819.09
8.2.80.0030.00617.97
8.2.70.0090.00017.63
8.2.60.0050.00317.80
8.2.50.0000.00818.10
8.2.40.0030.00522.27
8.2.30.0050.00519.16
8.2.20.0020.00517.96
8.2.10.0040.00418.26
8.2.00.0070.00018.19
8.1.280.0110.00425.92
8.1.270.0030.00523.82
8.1.260.0000.00826.35
8.1.250.0050.00328.09
8.1.240.0060.00322.54
8.1.230.0080.00419.06
8.1.220.0090.00017.74
8.1.210.0060.00318.77
8.1.200.0030.00617.48
8.1.190.0040.00417.36
8.1.180.0000.00818.10
8.1.170.0060.00318.66
8.1.160.0000.00718.95
8.1.150.0040.00418.97
8.1.140.0070.00319.57
8.1.130.0000.00718.86
8.1.120.0070.00017.40
8.1.110.0000.00817.37
8.1.100.0020.00517.46
8.1.90.0070.00017.51
8.1.80.0030.00317.48
8.1.70.0070.00017.46
8.1.60.0040.00417.59
8.1.50.0060.00317.51
8.1.40.0000.00817.60
8.1.30.0030.00517.79
8.1.20.0080.00017.64
8.1.10.0050.00217.71
8.1.00.0030.00617.48
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0070.00018.45
8.0.270.0030.00317.29
8.0.260.0000.00816.98
8.0.250.0070.00016.97
8.0.240.0080.00016.94
8.0.230.0030.00517.03
8.0.220.0040.00417.03
8.0.210.0000.00716.96
8.0.200.0000.00717.05
8.0.190.0000.00816.93
8.0.180.0000.00717.02
8.0.170.0030.00317.01
8.0.160.0000.00717.08
8.0.150.0000.00816.95
8.0.140.0070.00017.02
8.0.130.0000.00713.44
8.0.120.0030.00516.97
8.0.110.0040.00417.05
8.0.100.0050.00216.91
8.0.90.0030.00316.85
8.0.80.0170.00017.10
8.0.70.0000.00817.14
8.0.60.0040.00416.95
8.0.50.0040.00416.88
8.0.30.0050.01216.94
8.0.20.0120.00917.40
8.0.10.0000.00817.16
8.0.00.0030.01616.71
7.4.330.0000.00515.55
7.4.320.0030.00316.64
7.4.300.0070.00016.43
7.4.290.0080.00016.62
7.4.280.0030.00516.64
7.4.270.0070.00016.62
7.4.260.0000.00613.29
7.4.250.0070.00016.56
7.4.240.0060.00316.64
7.4.230.0050.00216.66
7.4.220.0150.00716.56
7.4.210.0060.01216.48
7.4.200.0030.00316.75
7.4.160.0100.00616.67
7.4.150.0090.00917.40
7.4.140.0090.01017.86
7.4.130.0070.01716.47
7.4.120.0130.00616.51
7.4.110.0070.01116.51
7.4.100.0160.00816.48
7.4.90.0070.00916.41
7.4.80.0100.01019.39
7.4.70.0090.00616.69
7.4.60.0070.01016.64
7.4.50.0070.00716.40
7.4.40.0030.01316.56
7.4.30.0160.00616.59
7.4.00.0030.01214.99
7.3.330.0050.00013.45
7.3.320.0050.00013.50
7.3.310.0030.00316.42
7.3.300.0060.00016.45
7.3.290.0060.00816.42
7.3.280.0100.00716.40
7.3.270.0090.00817.40
7.3.260.0090.00916.48
7.3.250.0100.00816.45
7.3.240.0080.01116.59
7.3.230.0130.00316.43
7.3.210.0090.00916.44
7.3.200.0070.01016.61
7.3.190.0100.00716.42
7.3.180.0100.00716.39
7.3.170.0130.00716.51
7.3.160.0030.01716.45
7.3.120.0000.01714.82
7.3.110.0030.01114.89
7.3.100.0140.00014.91
7.3.90.0060.00914.61
7.3.80.0080.00314.71
7.3.70.0120.00014.77
7.3.60.0040.01114.96
7.3.50.0060.01014.74
7.3.40.0030.01014.71
7.3.30.0100.00714.92
7.3.20.0060.00916.52
7.3.10.0070.00716.21
7.3.00.0100.00316.84
7.2.330.0040.01516.69
7.2.320.0100.01616.79
7.2.310.0070.01016.37
7.2.300.0060.01016.42
7.2.290.0180.00616.79
7.2.240.0060.00915.32
7.2.230.0060.00915.25
7.2.220.0090.00315.17
7.2.210.0060.00615.09
7.2.200.0040.01114.87
7.2.190.0070.00715.11
7.2.180.0030.01314.94
7.2.170.0040.01515.10
7.2.160.0120.00314.95
7.2.150.0000.01917.22
7.2.140.0070.01016.68
7.2.130.0100.00017.07
7.2.120.0080.00416.75
7.2.110.0040.01417.14
7.2.100.0060.00916.93
7.2.90.0030.01216.96
7.2.80.0090.00616.97
7.2.70.0040.01116.88
7.2.60.0030.01017.12
7.2.50.0080.00416.71
7.2.40.0030.01116.95
7.2.30.0030.01017.00
7.2.20.0040.00716.82
7.2.10.0100.00717.05
7.2.00.0050.00818.23
7.1.330.0000.00915.60
7.1.320.0090.00615.66
7.1.310.0060.00615.86
7.1.300.0060.00915.74
7.1.290.0110.00415.81
7.1.280.0000.01415.75
7.1.270.0060.00615.64
7.1.260.0080.00615.73
7.1.250.0110.00415.61
7.1.200.0110.00015.77
7.1.100.0030.00918.30
7.1.70.0040.00817.30
7.1.60.1230.01033.25
7.1.50.0930.01033.04
7.1.40.0770.01032.63
7.1.30.1000.01732.75
7.1.20.0900.00333.04
7.1.10.0630.01014.88
7.1.00.0830.00714.87
7.0.200.0970.01014.70
7.0.190.0970.00314.98
7.0.180.0700.00714.59
7.0.170.0970.01014.57
7.0.160.1370.00714.38
7.0.150.0630.00714.40
7.0.140.0700.01014.45
7.0.130.0830.01014.83
7.0.120.0800.00714.87
7.0.110.0770.01014.62
7.0.100.0770.00714.75
7.0.90.0730.01014.50
7.0.80.0730.01314.54
7.0.70.0700.01014.48
7.0.60.0800.01014.33
7.0.50.0700.01014.67
7.0.40.0730.01014.78
7.0.30.0700.01014.64
7.0.20.0770.00014.61
7.0.10.0730.00714.62
7.0.00.0770.00314.45

preferences:
57.94 ms | 401 KiB | 5 Q