3v4l.org

run code in 300+ PHP versions simultaneously
<?php $products = array(); class Products { public $chemID; public $catID; } $prod1 = new Products; $prod1->chemID=1; $prod1->catID=1; array_push($products,$prod1); for($i = 1; $i < 5; $i++) { ${'prod'.$i} = new Products; ${'prod'.$i}->chemID = $i; ${'prod'.$i}->catID = $i; array_push($products,${'prod'.$i}); } $carts = (object)array(array("chemID"=> 1, "catID" => 4),array("chemID"=> 2, "catID" => 4), array("chemID"=> 1, "catID" => 1)); var_dump($products); foreach($products as $key=>$value) { echo $value; }

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.00416.36
8.3.50.0160.00822.05
8.3.40.0070.00718.94
8.3.30.0100.00718.85
8.3.20.0100.01020.16
8.3.10.0060.00323.61
8.3.00.0040.00419.26
8.2.180.0120.00616.50
8.2.170.0110.00322.96
8.2.160.0070.01420.52
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0080.00017.50
8.2.120.0000.00826.35
8.2.110.0090.00022.02
8.2.100.0070.00418.03
8.2.90.0080.00019.23
8.2.80.0060.00317.97
8.2.70.0080.00017.63
8.2.60.0050.00317.93
8.2.50.0040.00418.07
8.2.40.0040.00419.31
8.2.30.0030.00520.52
8.2.20.0060.00317.87
8.2.10.0040.00418.11
8.2.00.0050.00318.22
8.1.280.0110.00425.92
8.1.270.0030.00523.98
8.1.260.0040.00428.09
8.1.250.0030.00528.09
8.1.240.0030.00722.42
8.1.230.0120.00017.66
8.1.220.0000.00817.79
8.1.210.0060.00318.77
8.1.200.0040.00417.25
8.1.190.0080.00017.35
8.1.180.0090.00018.10
8.1.170.0030.00618.76
8.1.160.0000.00721.92
8.1.150.0040.00418.80
8.1.140.0030.00619.62
8.1.130.0000.00717.70
8.1.120.0040.00417.54
8.1.110.0000.00717.41
8.1.100.0030.00517.48
8.1.90.0000.00717.43
8.1.80.0000.00717.43
8.1.70.0030.00517.34
8.1.60.0040.00417.52
8.1.50.0030.00517.54
8.1.40.0040.00417.40
8.1.30.0040.00717.63
8.1.20.0040.00417.60
8.1.10.0080.00017.57
8.1.00.0040.00417.54
8.0.300.0030.00518.77
8.0.290.0030.00616.75
8.0.280.0000.00718.54
8.0.270.0050.00317.24
8.0.260.0070.00017.16
8.0.250.0040.00417.04
8.0.240.0090.00017.01
8.0.230.0000.00717.00
8.0.220.0040.00416.89
8.0.210.0000.00716.94
8.0.200.0030.00316.96
8.0.190.0060.00317.05
8.0.180.0000.00816.99
8.0.170.0040.00416.86
8.0.160.0040.00416.96
8.0.150.0050.00216.78
8.0.140.0040.00416.96
8.0.130.0000.00613.42
8.0.120.0080.00016.90
8.0.110.0000.00817.00
8.0.100.0000.00716.97
8.0.90.0020.00516.82
8.0.80.0070.01316.95
8.0.70.0050.00316.84
8.0.60.0040.00417.02
8.0.50.0050.00316.95
8.0.30.0160.00517.27
8.0.20.0160.00717.40
8.0.10.0040.00417.01
8.0.00.0090.01116.75
7.4.330.0030.00316.77
7.4.320.0030.00316.64
7.4.300.0030.00316.55
7.4.290.0040.00416.52
7.4.280.0000.00916.48
7.4.270.0000.00816.61
7.4.260.0000.00716.58
7.4.250.0060.00316.38
7.4.240.0000.00716.55
7.4.230.0000.00716.34
7.4.220.0080.01316.55
7.4.210.0100.00516.54
7.4.200.0030.00316.68
7.4.160.0040.01316.46
7.4.150.0120.00917.40
7.4.140.0110.00717.86
7.4.130.0040.01416.50
7.4.120.0100.00716.56
7.4.110.0230.00316.51
7.4.100.0030.01816.70
7.4.90.0150.00316.39
7.4.80.0130.01019.39
7.4.70.0150.00316.48
7.4.60.0100.00716.71
7.4.50.0110.00716.42
7.4.40.0080.01116.68
7.4.30.0070.01116.61
7.4.00.0030.01115.18
7.3.330.0030.00313.32
7.3.320.0060.00013.39
7.3.310.0020.00516.41
7.3.300.0000.00816.34
7.3.290.0030.00316.41
7.3.280.0080.01116.36
7.3.270.0110.00817.40
7.3.260.0090.00916.55
7.3.250.0060.01516.33
7.3.240.0110.00816.44
7.3.230.0110.00716.57
7.3.210.0130.00616.48
7.3.200.0100.01016.65
7.3.190.0120.00516.40
7.3.180.0140.00316.50
7.3.170.0030.01416.45
7.3.160.0000.01816.28
7.3.10.0060.01016.36
7.3.00.0140.00316.44
7.2.330.0180.00616.76
7.2.320.0160.01016.73
7.2.310.0110.00716.49
7.2.300.0100.00716.82
7.2.290.0120.00916.80
7.2.130.0140.00016.84
7.2.120.0110.00816.88
7.2.110.0060.00916.67
7.2.100.0080.00716.60
7.2.90.0070.01017.04
7.2.80.0110.00016.90
7.2.70.0040.00816.98
7.2.60.0060.00916.99
7.2.50.0040.00716.68
7.2.40.0070.00716.58
7.2.30.0100.00817.03
7.2.20.0090.00616.89
7.2.10.0090.00316.83
7.2.00.0090.00818.07
7.1.250.0130.00615.70
7.1.200.0080.01015.72
7.1.100.0030.01018.06
7.1.70.0000.01317.01
7.1.60.0140.01019.48
7.1.50.0090.01216.96
7.1.00.0070.07022.27
7.0.200.0350.00314.36
7.0.60.0000.06320.04
7.0.50.0000.04317.92
7.0.40.0070.06720.27
7.0.30.0270.07020.06
7.0.20.0230.08020.07
7.0.10.0130.07320.07
7.0.00.0200.07720.33
5.6.280.0030.04720.99
5.6.210.0130.07320.68
5.6.200.0100.06718.16
5.6.190.0130.08320.39
5.6.180.0230.03720.55
5.6.170.0200.03720.51
5.6.160.0170.07720.45
5.6.150.0070.06718.17
5.6.140.0030.06318.11
5.6.130.0130.07718.14
5.6.120.0100.06321.14
5.6.110.0130.06721.01
5.6.100.0070.04021.01
5.6.90.0000.09320.97
5.6.80.0070.08020.40
5.5.350.0230.04020.38
5.5.340.0030.03717.98
5.5.330.0000.04720.13
5.5.320.0100.05720.29
5.5.310.0070.05020.27
5.5.300.0030.05318.08
5.5.290.0070.06018.04
5.5.280.0000.05020.73
5.5.270.0070.06020.86
5.5.260.0130.05020.73
5.5.250.0030.08720.71
5.5.240.0170.08020.33

preferences:
64.47 ms | 401 KiB | 5 Q