3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace ECommerce { use Exception; class CreditCardValidationException extends Exception { } class CreditCardNumber { private $digits; public function __construct($digits) { $this->digits = $digits; if (!$this->_validate()) { throw new CreditCardValidationException('Checksum failed'); } } private function _validate() { for($i=0,$t=0;$i<16;$i+=2) $t+=(($d=((int)$this->digits{$i}*2))>9?array_sum(array_map('intval',str_split(strval($d)))):$d)+$this->digits{$i+1}; return(bool)($t%10===0); } } } namespace { try { $ccn = new ECommerce\CreditCardNumber('4417123456789114'); } catch (ECommerce\CreditCardValidationException $exception) { echo 'Invalid credit card number'; } finally { echo 'DONE'; } }

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.0170.00318.24
8.3.50.0120.00621.84
8.3.40.0150.00018.89
8.3.30.0100.00318.96
8.3.20.0040.00420.16
8.3.10.0000.00823.48
8.3.00.0000.00820.76
8.2.180.0120.00316.50
8.2.170.0100.01022.96
8.2.160.0070.00722.25
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0000.00722.31
8.2.110.0090.00021.00
8.2.100.0080.00417.91
8.2.90.0050.00318.95
8.2.80.0030.00517.97
8.2.70.0040.00417.63
8.2.60.0000.01017.88
8.2.50.0070.00318.07
8.2.40.0070.00019.34
8.2.30.0040.00417.82
8.2.20.0000.00717.49
8.2.10.0080.00019.45
8.2.00.0000.00817.54
8.1.280.0100.00725.92
8.1.270.0040.00423.82
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0070.00319.16
8.1.230.0040.00720.89
8.1.220.0080.00017.74
8.1.210.0060.00318.77
8.1.200.0000.01017.23
8.1.190.0040.00417.41
8.1.180.0030.00518.10
8.1.170.0080.00018.53
8.1.160.0040.00421.95
8.1.150.0020.00518.36
8.1.140.0000.00817.20
8.1.130.0000.00717.75
8.1.120.0030.00517.25
8.1.110.0050.00317.25
8.1.100.0040.00417.19
8.1.90.0070.00017.24
8.1.80.0070.00017.30
8.1.70.0000.00717.32
8.1.60.0070.00017.48
8.1.50.0040.00417.42
8.1.40.0030.00517.37
8.1.30.0000.00817.47
8.1.20.0030.00617.53
8.1.10.0040.00417.28
8.1.00.0070.00017.23
8.0.300.0000.00818.77
8.0.290.0000.00817.05
8.0.280.0070.00018.24
8.0.270.0070.00017.05
8.0.260.0070.00016.77
8.0.250.0000.00716.90
8.0.240.0030.00616.87
8.0.230.0030.00516.88
8.0.220.0070.00016.73
8.0.210.0000.00716.83
8.0.200.0070.00016.80
8.0.190.0030.00616.87
8.0.180.0050.00316.86
8.0.170.0040.00416.76
8.0.160.0080.00016.86
8.0.150.0070.00016.75
8.0.140.0000.00716.68
8.0.130.0050.00013.30
8.0.120.0000.00916.84
8.0.110.0040.00416.71
8.0.100.0070.00016.94
8.0.90.0030.00416.69
8.0.80.0100.00616.78
8.0.70.0040.00416.88
8.0.60.0040.00416.73
8.0.50.0000.00716.68
8.0.30.0090.00916.98
8.0.20.0100.00917.40
8.0.10.0030.00516.79
8.0.00.0070.01116.66
7.4.330.0020.00215.09
7.4.320.0040.00416.53
7.4.300.0000.00616.44
7.4.290.0070.00016.61
7.4.280.0000.00716.53
7.4.270.0030.00316.55
7.4.260.0070.00016.61
7.4.250.0040.00416.56
7.4.240.0020.00616.49
7.4.230.0000.00716.52
7.4.220.0060.01516.58
7.4.210.0070.00916.61
7.4.200.0040.00416.43
7.4.190.0000.00716.59
7.4.160.0190.00316.70
7.4.150.0110.00717.40
7.4.140.0090.00917.86
7.4.130.0080.01016.52
7.4.120.0140.00416.60
7.4.110.0070.01016.59
7.4.100.0090.00916.39
7.4.90.0100.00716.57
7.4.80.0110.01116.52
7.4.70.0170.00316.62
7.4.60.0200.00016.41
7.4.50.0050.00316.54
7.4.40.0000.01422.77
7.4.30.0090.00616.45
7.4.00.0100.00615.16
7.3.330.0060.00013.33
7.3.320.0000.00613.46
7.3.310.0070.00016.46
7.3.300.0070.00016.51
7.3.290.0110.00816.46
7.3.280.0090.01016.43
7.3.270.0140.00317.40
7.3.260.0060.01216.55
7.3.250.0130.00516.47
7.3.240.0110.01116.43
7.3.230.0000.01716.66
7.3.210.0030.01616.50
7.3.200.0060.01619.39
7.3.190.0060.01616.43
7.3.180.0130.00316.60
7.3.170.0120.00316.41
7.3.160.0060.01216.45
7.3.120.0110.00414.96
7.3.10.0100.01416.09
7.3.00.0170.00316.04
7.2.330.0120.00616.56
7.2.320.0000.02016.76
7.2.310.0070.01016.66
7.2.300.0100.01016.40
7.2.290.0090.00616.84
7.2.130.0110.00716.16
7.2.120.0130.00816.21
7.2.110.0230.00316.25
7.2.100.0130.00716.32
7.2.90.0170.00616.53
7.2.80.0140.00616.34
7.2.70.0150.00616.11
7.2.60.0100.01016.04
7.2.50.0080.01616.21
7.2.40.0090.01516.21
7.2.30.0180.00916.48
7.2.20.0120.01116.32
7.2.10.0170.01016.12
7.2.00.0110.00716.85
7.1.250.0100.00315.57
7.1.70.0080.00017.20
7.1.60.0130.01319.29
7.1.50.0090.01517.06
7.1.00.0100.06722.54
7.0.200.0070.00416.84
7.0.140.0100.06722.18
7.0.60.0200.08321.75
7.0.50.0030.04017.90
7.0.40.0100.09020.24
7.0.30.0100.04720.10
7.0.20.0270.06720.15
7.0.10.0000.08720.24
7.0.00.0070.04320.23
5.6.280.0070.07021.12
5.6.210.0000.04320.52
5.6.200.0030.04018.19
5.6.190.0070.08320.45
5.6.180.0370.04320.52
5.6.170.0230.04320.47
5.6.160.0130.08020.48
5.6.150.0070.08318.22
5.6.140.0030.08318.23
5.6.130.0070.08318.14
5.6.120.0100.08020.99
5.6.110.0070.07321.15
5.6.100.0170.08021.02
5.6.90.0070.06721.03
5.6.80.0100.07320.39
5.5.350.0230.06720.46
5.5.340.0070.07718.08
5.5.330.0000.06320.42
5.5.320.0370.07020.33
5.5.310.0230.08320.30
5.5.300.0070.08018.04
5.5.290.0100.07717.98
5.5.280.0070.08720.82
5.5.270.0170.06320.66
5.5.260.0130.07720.81
5.5.250.0030.04020.70
5.5.240.0330.06320.30
5.4.450.3730.04019.52
5.4.440.0070.07719.40
5.4.430.2330.06019.46
5.4.420.3870.03319.22
5.4.410.4500.03719.09
5.4.400.3600.03719.04
5.4.390.4200.03318.90
5.4.380.4170.03719.21
5.4.370.4400.04319.24
5.4.360.4370.03319.04
5.4.350.4400.03319.19
5.4.340.3730.03719.04
5.4.320.3630.04019.13
5.4.310.3670.03719.13
5.4.300.2770.03019.23
5.4.290.3730.03718.96
5.4.280.4070.03719.19
5.4.270.3930.03718.90
5.4.260.4270.04019.04
5.4.250.3770.03718.89
5.4.240.3770.03319.16
5.4.230.3300.03718.93
5.4.220.3770.04318.89
5.4.210.4300.04318.96
5.4.200.4530.04018.96
5.4.190.4000.03319.15
5.4.180.3900.04018.93
5.4.170.4230.03719.18
5.4.160.4270.03019.10
5.4.150.4330.04019.02
5.4.140.4170.03316.53
5.4.130.4230.03016.53
5.4.120.4700.03716.39
5.4.110.4430.03716.27
5.4.100.3130.03316.49
5.4.90.2500.03316.53
5.4.80.2870.04016.59
5.4.70.3200.03316.53
5.4.60.3000.03716.50
5.4.50.0030.03316.21
5.4.40.1600.03316.42
5.4.30.2030.03716.30
5.4.20.3100.03716.50
5.4.10.3170.03716.32
5.4.00.3800.03715.86
5.3.290.3800.04014.71
5.3.280.3830.04014.65
5.3.270.3570.04014.69
5.3.260.4270.03714.64
5.3.250.4130.04314.76
5.3.240.3730.04014.61
5.3.230.4470.04714.65
5.3.220.4300.03714.63
5.3.210.4230.03714.61
5.3.200.4730.04014.59
5.3.190.3570.03714.60
5.3.180.3770.03014.57
5.3.170.3800.04014.57
5.3.160.2470.03714.60
5.3.150.0130.03314.59
5.3.140.0100.03314.49
5.3.130.2570.03714.63
5.3.120.2430.03714.63
5.3.110.3170.03714.57
5.3.100.2100.03314.11
5.3.90.3700.03314.08
5.3.80.4030.03714.18
5.3.70.3830.04014.09
5.3.60.4000.02313.94
5.3.50.4230.04014.04
5.3.40.4070.03313.98
5.3.30.3700.03713.91
5.3.20.3470.03313.75
5.3.10.0030.03313.56
5.3.00.0570.03313.60
5.2.170.3830.02311.04
5.2.160.3430.02311.23
5.2.150.3430.03311.00
5.2.140.3130.03311.07
5.2.130.3100.03011.11
5.2.120.0070.02311.03
5.2.110.0030.02711.00
5.2.100.2730.03311.04
5.2.90.3570.03010.98
5.2.80.3000.02310.98
5.2.70.2770.03011.02
5.2.60.2800.03710.96
5.2.50.3270.03010.94
5.2.40.2470.03311.00
5.2.30.3170.02310.91
5.2.20.2870.02010.93
5.2.10.2630.02710.76
5.2.00.3300.03310.87
5.1.60.3230.0239.99
5.1.50.3000.0309.99
5.1.40.3070.0209.90
5.1.30.2770.02710.34
5.1.20.3500.02010.25
5.1.10.3270.02710.12
5.1.00.3170.03310.13
5.0.50.1700.0238.54
5.0.40.1270.0208.31
5.0.30.1430.0338.37
5.0.20.1630.0208.15
5.0.10.1600.0208.20
5.0.00.1530.0338.06
4.4.90.1270.0205.89
4.4.80.1170.0235.79
4.4.70.1270.0135.80
4.4.60.1300.0175.85
4.4.50.1270.0135.80
4.4.40.1830.0205.76
4.4.30.1830.0135.88
4.4.20.2130.0105.88
4.4.10.1730.0175.87
4.4.00.1370.0305.84
4.3.110.1370.0205.80
4.3.100.1500.0175.77
4.3.90.0500.0305.68
4.3.80.1500.0235.69
4.3.70.1430.0135.74
4.3.60.1300.0205.75
4.3.50.1330.0175.71
4.3.40.1670.0235.72
4.3.30.0500.0335.32
4.3.20.0700.0235.32
4.3.10.0970.0235.32
4.3.00.1000.0135.32

preferences:
45.2 ms | 401 KiB | 5 Q