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('4417123456789113'); } catch (ECommerce\CreditCardValidationException $exception) { echo 'Invalid credit card number'; } }

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.40.0030.01418.42
8.3.30.0000.01718.89
8.3.20.0000.00820.20
8.3.10.0050.00323.61
8.3.00.0000.00720.82
8.2.170.0060.00822.96
8.2.160.0100.00322.13
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00422.29
8.2.110.0060.00322.16
8.2.100.0080.00417.47
8.2.90.0030.00619.05
8.2.80.0040.00417.97
8.2.70.0130.00017.25
8.2.60.0040.00417.80
8.2.50.0070.00318.07
8.2.40.0040.00419.41
8.2.30.0000.00717.84
8.2.20.0040.00417.41
8.2.10.0080.00017.53
8.2.00.0050.00317.47
8.1.270.0070.00023.67
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0040.00423.83
8.1.230.0030.00719.09
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0060.00317.10
8.1.190.0080.00017.41
8.1.180.0030.00618.10
8.1.170.0030.00518.53
8.1.160.0000.00721.95
8.1.150.0040.00418.52
8.1.140.0030.00617.34
8.1.130.0030.00317.78
8.1.120.0000.00717.29
8.1.110.0040.00417.39
8.1.100.0040.00417.32
8.1.90.0030.00617.37
8.1.80.0000.00717.32
8.1.70.0030.00317.20
8.1.60.0030.00517.47
8.1.50.0040.00417.38
8.1.40.0000.00817.37
8.1.30.0030.00517.39
8.1.20.0070.00017.54
8.1.10.0000.00817.28
8.1.00.0040.00417.34
8.0.300.0070.00018.77
8.0.290.0030.00516.92
8.0.280.0000.00718.24
8.0.270.0000.00817.06
8.0.260.0070.00016.76
8.0.250.0000.00716.96
8.0.240.0090.00016.89
8.0.230.0030.00316.91
8.0.220.0000.00816.75
8.0.210.0030.00316.79
8.0.200.0060.00016.79
8.0.190.0030.00516.77
8.0.180.0000.00716.77
8.0.170.0040.00416.84
8.0.160.0040.00416.71
8.0.150.0030.00316.83
8.0.140.0070.00016.73
8.0.130.0000.00513.33
8.0.120.0000.00916.80
8.0.110.0070.00016.84
8.0.100.0030.00516.82
8.0.90.0000.00716.84
8.0.80.0130.01016.81
8.0.70.0000.00716.89
8.0.60.0040.00416.81
8.0.50.0040.00416.82
8.0.30.0160.00716.90
8.0.20.0130.00517.40
8.0.10.0000.00816.98
8.0.00.0100.00816.54
7.4.330.0050.00015.08
7.4.320.0000.00616.65
7.4.300.0030.00316.55
7.4.290.0000.00816.54
7.4.280.0020.00516.65
7.4.270.0030.00316.61
7.4.260.0030.00316.61
7.4.250.0040.00416.61
7.4.240.0040.00316.63
7.4.230.0040.00416.39
7.4.220.0140.00416.58
7.4.210.0060.00816.71
7.4.200.0030.00316.39
7.4.190.0030.00316.80
7.4.160.0060.00916.61
7.4.150.0120.00617.40
7.4.140.0080.00917.86
7.4.130.0070.01016.63
7.4.120.0120.00616.47
7.4.110.0170.00016.83
7.4.100.0080.01116.53
7.4.90.0110.00616.72
7.4.80.0130.01016.40
7.4.70.0090.00916.41
7.4.60.0070.01316.58
7.4.50.0000.00816.70
7.4.40.0070.00722.77
7.4.30.0110.00516.58
7.4.00.0000.01614.95
7.3.330.0020.00313.30
7.3.320.0000.00613.38
7.3.310.0000.00716.39
7.3.300.0000.00616.29
7.3.290.0080.00616.41
7.3.280.0110.00716.40
7.3.270.0140.00317.40
7.3.260.0080.01016.39
7.3.250.0050.01216.50
7.3.240.0100.00716.35
7.3.230.0040.01216.39
7.3.210.0210.01516.59
7.3.200.0160.00619.39
7.3.190.0070.01616.59
7.3.180.0130.00316.41
7.3.170.0060.00916.38
7.3.160.0100.01116.49
7.3.120.0030.00815.10
7.2.330.0110.00616.80
7.2.320.0120.00616.54
7.2.310.0130.00316.70
7.2.300.0110.00716.86
7.2.290.0060.01016.48
7.1.200.0060.00315.79
7.1.70.0100.00017.06
7.1.60.0090.01619.29
7.1.50.0070.01717.00
7.1.00.0030.07722.57
7.0.200.0020.00516.39
7.0.140.0000.07721.95
7.0.70.0100.07721.68
7.0.60.0100.07321.56
7.0.50.0130.07022.07
7.0.40.0030.06720.08
7.0.30.0030.07020.08
7.0.20.0070.07320.14
7.0.10.0070.08020.11
7.0.00.0000.10019.93
5.6.280.0100.06720.93
5.6.220.0000.08020.56
5.6.210.0070.08320.77
5.6.200.0070.06720.95
5.6.190.0030.07021.07
5.6.180.0070.04021.09
5.6.170.0030.07321.01
5.6.160.0070.05721.04
5.6.150.0070.04020.90
5.6.140.0000.05321.02
5.6.130.0070.08321.04
5.6.120.0170.05721.08
5.6.110.0000.06321.09
5.6.100.0070.07021.08
5.6.90.0030.08321.06
5.6.80.0070.05720.40
5.6.70.0070.05020.34
5.6.60.0100.06320.43
5.6.50.0070.07720.41
5.6.40.0070.05720.42
5.6.30.0070.07020.41
5.6.20.0070.07320.42
5.6.10.0000.07020.46
5.6.00.0000.06720.38
5.5.360.0130.07320.42
5.5.350.0030.07020.38
5.5.340.0070.06320.89
5.5.330.0100.07320.89
5.5.320.0100.07020.77
5.5.310.0100.08020.84
5.5.300.0070.08020.89
5.5.290.0100.07720.61
5.5.280.0000.09020.88
5.5.270.0130.07320.83
5.5.260.0070.06720.85
5.5.250.0000.08320.67
5.5.240.0000.08320.24
5.5.230.0030.08020.18
5.5.220.0070.07320.12
5.5.210.0070.05320.27
5.5.200.0100.06020.25
5.5.190.0100.07720.12
5.5.180.0000.07719.99
5.5.160.0100.06020.21
5.5.150.0000.08020.24
5.5.140.0070.07020.10
5.5.130.0000.08020.20
5.5.120.0000.08320.25
5.5.110.0070.08020.27
5.5.100.0070.07320.00
5.5.90.0030.05720.16
5.5.80.0030.06320.13
5.5.70.0130.07320.07
5.5.60.0030.06319.93
5.5.50.0000.07720.13
5.5.40.0030.06720.04
5.5.30.0030.08020.15
5.5.20.0000.08720.04
5.5.10.0130.06720.10
5.5.00.0030.05720.08
5.4.450.0030.08019.46
5.4.440.0170.07019.13
5.4.430.0100.05319.31
5.4.420.0070.08019.46
5.4.410.0030.07019.30
5.4.400.0100.07019.14
5.4.390.0030.05018.89
5.4.380.0030.05319.14
5.4.370.0030.07319.14
5.4.360.0000.08019.14
5.4.350.0030.05318.99
5.4.340.0030.07718.86
5.4.320.0030.06319.12
5.4.310.0070.06019.02
5.4.300.0100.07019.01
5.4.290.0030.07719.14
5.4.280.0000.08018.98
5.4.270.0030.07719.13
5.4.260.0070.07319.22
5.4.250.0000.06718.91
5.4.240.0100.07018.92
5.4.230.0070.07718.86
5.4.220.0100.06019.01
5.4.210.0030.05019.03
5.4.200.0070.06719.16
5.4.190.0000.06318.91
5.4.180.0070.04719.15
5.4.170.0130.05319.13
5.4.160.0100.07019.12
5.4.150.0030.06319.04
5.4.140.0030.04016.47
5.4.130.0070.07016.50
5.4.120.0100.06716.50
5.4.110.0000.07016.51
5.4.100.0030.07016.39
5.4.90.0030.06716.49
5.4.80.0070.06716.38
5.4.70.0070.06716.52
5.4.60.0030.06316.36
5.4.50.0070.06316.32
5.4.40.0000.05716.47
5.4.30.0000.05716.30
5.4.20.0070.06716.23
5.4.10.0000.07716.45
5.4.00.0000.07715.89
5.3.290.0030.03714.88
5.3.280.0030.07314.88
5.3.270.0030.05314.88
5.3.260.0000.08314.88
5.3.250.0030.06714.88
5.3.240.0030.07314.88
5.3.230.0030.05314.88
5.3.220.0030.07014.88
5.3.210.0030.08014.88
5.3.200.0100.07014.88
5.3.190.0000.07714.88
5.3.180.0030.07314.88
5.3.170.0070.07014.88
5.3.160.0030.04314.88
5.3.150.0030.06714.88
5.3.140.0000.08314.88
5.3.130.0000.08314.88
5.3.120.0000.07714.88
5.3.110.0000.05714.88
5.3.100.0070.06714.88
5.3.90.0000.06314.88
5.3.80.0030.07014.88
5.3.70.0100.05714.88
5.3.60.0000.07314.88
5.3.50.0000.05714.88
5.3.40.0070.04714.88
5.3.30.0030.07714.88
5.3.20.0000.06314.88
5.3.10.0030.06314.88
5.3.00.0030.05714.88
5.2.170.0070.04714.88
5.2.160.0030.05714.88
5.2.150.0000.05014.88
5.2.140.0030.06014.88
5.2.130.0000.04714.88
5.2.120.0070.05714.88
5.2.110.0100.05314.88
5.2.100.0030.07014.88
5.2.90.0030.05314.88
5.2.80.0030.05714.88
5.2.70.0000.07014.88
5.2.60.0070.04014.88
5.2.50.0000.05314.88
5.2.40.0030.05714.88
5.2.30.0030.05314.88
5.2.20.0100.04714.88
5.2.10.0170.05314.88
5.2.00.0070.03714.88
5.1.60.0030.05314.88
5.1.50.0000.05314.88
5.1.40.0000.04314.88
5.1.30.0070.04014.88
5.1.20.0030.06014.88
5.1.10.0070.05314.88
5.1.00.0070.04314.88
5.0.50.0000.04314.88
5.0.40.0000.03314.88
5.0.30.0000.07014.88
5.0.20.0030.02014.88
5.0.10.0030.03714.88
5.0.00.0000.04714.88
4.4.90.0030.02314.88
4.4.80.0000.02714.88
4.4.70.0000.03314.88
4.4.60.0000.03714.88
4.4.50.0000.03014.88
4.4.40.0100.04714.88
4.4.30.0030.03014.88
4.4.20.0000.03714.88
4.4.10.0030.03314.88
4.4.00.0030.05314.88
4.3.110.0000.03014.88
4.3.100.0000.02314.88
4.3.90.0030.02714.88
4.3.80.0000.03014.88
4.3.70.0030.02314.88
4.3.60.0030.03014.88
4.3.50.0000.01714.88
4.3.40.0000.03014.88
4.3.30.0000.04014.88
4.3.20.0000.02714.88
4.3.10.0000.03014.88
4.3.00.0000.03714.88

preferences:
40.11 ms | 400 KiB | 5 Q