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 { if (!isset($exception)) { echo 'VALID 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.60.0140.00716.75
8.3.50.0180.00521.93
8.3.40.0070.01018.69
8.3.30.0110.00418.84
8.3.20.0050.00320.34
8.3.10.0040.00421.60
8.3.00.0080.00020.77
8.2.180.0060.00916.38
8.2.170.0100.00322.96
8.2.160.0140.00022.14
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0030.00626.16
8.2.120.0000.00822.21
8.2.110.0040.00422.06
8.2.100.0080.00417.66
8.2.90.0050.00319.05
8.2.80.0000.00817.97
8.2.70.0040.00417.50
8.2.60.0000.00717.79
8.2.50.0070.00418.07
8.2.40.0000.00819.34
8.2.30.0070.00017.82
8.2.20.0040.00417.52
8.2.10.0050.00319.24
8.2.00.0040.00617.59
8.1.280.0120.00325.92
8.1.270.0000.00923.88
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0000.00923.98
8.1.230.0080.00319.00
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0060.00317.10
8.1.190.0000.00817.41
8.1.180.0080.00018.10
8.1.170.0040.00418.49
8.1.160.0000.00721.95
8.1.150.0040.00418.48
8.1.140.0000.00717.33
8.1.130.0070.00017.68
8.1.120.0030.00317.40
8.1.110.0040.00417.36
8.1.100.0000.00817.35
8.1.90.0020.00517.34
8.1.80.0030.00317.33
8.1.70.0030.00317.20
8.1.60.0040.00417.43
8.1.50.0000.00817.42
8.1.40.0000.00817.30
8.1.30.0040.00417.50
8.1.20.0000.00817.50
8.1.10.0020.00517.34
8.1.00.0080.00017.25
8.0.300.0070.00018.77
8.0.290.0040.00417.03
8.0.280.0030.00318.43
8.0.270.0030.00317.10
8.0.260.0030.00316.63
8.0.250.0050.00316.94
8.0.240.0030.00616.91
8.0.230.0030.00316.87
8.0.220.0050.00216.87
8.0.210.0000.00816.84
8.0.200.0040.00416.76
8.0.190.0080.00016.90
8.0.180.0040.00416.85
8.0.170.0040.00416.88
8.0.160.0040.00416.84
8.0.150.0070.00016.74
8.0.140.0040.00416.75
8.0.130.0030.00313.30
8.0.120.0030.00516.84
8.0.110.0000.00716.80
8.0.100.0040.00416.86
8.0.90.0030.00316.82
8.0.80.0060.00916.82
8.0.70.0040.00416.65
8.0.60.0040.00416.85
8.0.50.0040.00416.70
8.0.30.0120.00717.01
8.0.20.0120.00817.40
8.0.10.0000.00916.80
8.0.00.0140.00416.61
7.4.330.0030.00315.15
7.4.320.0030.00316.54
7.4.300.0000.00616.62
7.4.290.0000.00716.62
7.4.280.0030.00316.63
7.4.270.0070.00016.46
7.4.260.0000.00716.51
7.4.250.0030.00616.58
7.4.240.0000.00716.47
7.4.230.0000.00716.65
7.4.220.0150.00316.58
7.4.210.0060.00816.57
7.4.200.0040.00416.33
7.4.190.0070.00016.59
7.4.160.0030.01616.51
7.4.150.0040.01517.40
7.4.140.0140.01617.86
7.4.130.0140.00316.67
7.4.120.0060.01216.54
7.4.110.0060.01216.48
7.4.100.0060.01616.58
7.4.90.0070.01616.66
7.4.80.0060.01516.39
7.4.70.0100.00716.76
7.4.60.0110.01516.68
7.4.50.0030.00316.64
7.4.40.0060.01022.77
7.4.30.0100.00716.48
7.4.00.0040.01415.17
7.3.330.0020.00213.54
7.3.320.0050.00013.47
7.3.310.0040.00416.50
7.3.300.0000.00716.39
7.3.290.0070.00716.46
7.3.280.0060.01116.47
7.3.270.0070.01017.40
7.3.260.0100.00716.42
7.3.250.0170.00216.63
7.3.240.0070.01716.58
7.3.230.0130.00316.50
7.3.210.0070.01016.44
7.3.200.0020.01819.39
7.3.190.0100.01016.61
7.3.180.0070.01016.46
7.3.170.0110.00716.46
7.3.160.0090.00916.48
7.3.120.0160.00015.00
7.2.330.0090.00916.70
7.2.320.0060.01216.52
7.2.310.0110.00716.67
7.2.300.0070.01016.66
7.2.290.0060.01116.71
7.2.00.0060.00919.39
7.1.100.0070.00418.35
7.1.70.0000.00816.77
7.1.60.0120.01219.29
7.1.50.0060.01816.66
7.1.00.0070.07322.41
7.0.200.0030.00916.67
7.0.140.0030.07322.01
7.0.60.0030.04319.93
7.0.50.0100.07017.90
7.0.40.0130.03720.40
7.0.30.0270.07320.19
7.0.20.0330.07720.24
7.0.10.0200.07020.10
7.0.00.0030.05720.16
5.6.280.0000.07720.94
5.6.210.0030.08720.62
5.6.200.0100.04718.19
5.6.190.0100.08320.41
5.6.180.0000.06720.57
5.6.170.0330.04720.71
5.6.160.0130.07320.42
5.6.150.0070.07018.18
5.6.140.0070.08318.18
5.6.130.0030.08318.15
5.6.120.0100.04021.16
5.6.110.0230.07321.07
5.6.100.0100.08020.97
5.6.90.0100.08020.98
5.6.80.0070.07720.39
5.6.70.0370.07720.41
5.5.350.0100.07720.42
5.5.340.0070.08018.08
5.5.330.0100.04020.34
5.5.320.0000.04320.27
5.5.310.0230.03320.41
5.5.300.0070.07717.98
5.5.290.0100.08717.96
5.5.280.0130.07720.98
5.5.270.0100.04020.74
5.5.260.0030.08320.78
5.5.250.0170.07320.72
5.5.240.0070.06720.08
5.4.450.0670.04019.53
5.4.440.0730.06019.47
5.4.430.0870.04719.63
5.4.420.0070.05719.60
5.4.410.0900.05319.26
5.4.400.0500.05718.51
5.4.390.0400.04318.73
5.4.380.0070.06018.80
5.4.370.0200.05318.48
5.4.360.0070.05718.84
5.4.350.0130.05718.74
5.4.340.0200.05018.47
5.4.320.0040.04112.54
5.4.310.0070.04012.53
5.4.300.0050.03712.53
5.4.290.0050.04512.52
5.4.280.0050.04112.42
5.4.270.0090.03812.42
5.4.260.0070.03612.42
5.4.250.0070.04412.42
5.4.240.0080.03412.39
5.4.230.0030.04012.38
5.4.220.0090.04312.39
5.4.210.0060.03712.38
5.4.200.0040.03912.39
5.4.190.0080.04112.38
5.4.180.0070.03412.38
5.4.170.0040.04512.39
5.4.160.0050.03912.38
5.4.150.0060.03412.38
5.4.140.0040.04512.07
5.4.130.0060.03512.05
5.4.120.0070.04212.02
5.4.110.0070.03712.01
5.4.100.0050.03512.01
5.4.90.0060.03612.01
5.4.80.0030.03912.01
5.4.70.0060.03912.00
5.4.60.0060.03412.01
5.4.50.0040.03612.01
5.4.40.0070.03211.99
5.4.30.0080.03411.99
5.4.20.0040.03711.98
5.4.10.0100.03112.00
5.4.00.0030.03811.49
5.3.290.0060.04412.80
5.3.280.0070.03612.71
5.3.270.0040.04112.72
5.3.260.0060.03812.72
5.3.250.0080.03512.72
5.3.240.0060.03812.72
5.3.230.0040.03912.71
5.3.220.0050.03712.68
5.3.210.0050.04012.68
5.3.200.0050.03612.68
5.3.190.0070.04112.68
5.3.180.0060.04212.67
5.3.170.0060.03612.66
5.3.160.0080.03912.67
5.3.150.0030.03912.68
5.3.140.0040.03812.66
5.3.130.0090.04112.66
5.3.120.0080.03812.66
5.3.110.0120.04212.66
5.3.100.0090.03412.11
5.3.90.0040.03812.08
5.3.80.0040.03712.07
5.3.70.0040.04012.07
5.3.60.0070.04612.07
5.3.50.0080.03612.00
5.3.40.0050.03712.00
5.3.30.0050.04011.97
5.3.20.0050.03911.75
5.3.10.0060.03811.71
5.3.00.0060.03511.70
5.2.170.0060.0349.15
5.2.160.0070.0349.15
5.2.150.0080.0279.15
5.2.140.0050.0329.15
5.2.130.0060.0279.11
5.2.120.0090.0259.11
5.2.110.0040.0319.11
5.2.100.0040.0329.12
5.2.90.0040.0299.11
5.2.80.0030.0319.10
5.2.70.0040.0319.10
5.2.60.0040.0329.05
5.2.50.0040.0419.03
5.2.40.0050.0309.00
5.2.30.0000.0348.97
5.2.20.0040.0298.97
5.2.10.0030.0318.89
5.2.00.0020.0348.75
5.1.60.0050.0238.04
5.1.50.0040.0298.04
5.1.40.0060.0228.02
5.1.30.0020.0288.36
5.1.20.0020.0288.39
5.1.10.0040.0278.12
5.1.00.0040.0288.11
5.0.50.0060.0176.59
5.0.40.0040.0276.45
5.0.30.0030.0346.27
5.0.20.0020.0206.23
5.0.10.0030.0206.21
5.0.00.0020.0316.20
4.4.90.0020.0164.78
4.4.80.0040.0144.75
4.4.70.0030.0154.76
4.4.60.0010.0174.75
4.4.50.0050.0154.77
4.4.40.0040.0234.71
4.4.30.0030.0154.76
4.4.20.0020.0164.84
4.4.10.0060.0184.85
4.4.00.0020.0304.76
4.3.110.0050.0134.67
4.3.100.0000.0184.66
4.3.90.0030.0144.63
4.3.80.0030.0294.59
4.3.70.0020.0204.63
4.3.60.0040.0174.63
4.3.50.0040.0184.63
4.3.40.0040.0264.54
4.3.30.0040.0133.27
4.3.20.0020.0153.25
4.3.10.0000.0173.21
4.3.00.0130.01313.64

preferences:
44.24 ms | 401 KiB | 5 Q