3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Example { public $length, $height, $width, $weight; public function __construct($length, $height, $width, $weight) { $this->length = $length; $this->height = $height; $this->width = $width; $this->weight = $weight; } public function get_price() { return 1.23; } } $sample_data = [ 42 => ['quantity' => 2, 'data' => new Example(42, 42, 42, 42)], 69 => ['quantity' => 1, 'data' => new Example(69, 69, 69, 69)], ]; $i = 0; $totalweight = 0; $totalprice = 0; foreach ( $sample_data as $item_id => $values ) { $_product = $values['data']; $q = 1; while ( $values['quantity'] >= $q ) { $products[ $i ]->length = $_product->length; $products[ $i ]->height = $_product->height; $products[ $i ]->width = $_product->width; $products[ $i ]->weight = $_product->weight; $totalweight += $_product->weight; $totalprice += $_product->get_price(); $q++; $i++; } } var_dump($products);

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.4.130.0120.01017.68
8.4.120.0090.01123.99
8.4.110.0150.00518.57
8.4.100.0110.01117.95
8.4.90.0080.00920.65
8.4.80.0030.00518.72
8.4.70.0120.00818.89
8.4.60.0100.01018.73
8.4.50.0020.00717.86
8.4.40.0150.00320.26
8.4.30.0170.00420.61
8.4.20.0060.01220.89
8.4.10.0060.00324.23
8.3.260.0110.00916.97
8.3.250.0130.00616.73
8.3.240.0090.00917.12
8.3.230.0100.00916.69
8.3.220.0030.00518.81
8.3.210.0150.00518.48
8.3.200.0130.00616.79
8.3.190.0060.00918.91
8.3.180.0100.00916.91
8.3.170.0130.00016.68
8.3.160.0140.00418.61
8.3.150.0190.00018.86
8.3.140.0040.01116.72
8.3.130.0120.00318.75
8.3.120.0000.00918.82
8.3.110.0130.00320.94
8.3.100.0040.00416.63
8.3.90.0040.00426.77
8.3.80.0060.00316.63
8.3.70.0040.01116.63
8.3.60.0110.00416.63
8.3.50.0120.00620.41
8.3.40.0090.00619.26
8.3.30.0090.00619.09
8.3.20.0050.00324.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.290.0120.00520.68
8.2.280.0120.00820.03
8.2.270.0110.00718.60
8.2.260.0050.00320.52
8.2.250.0030.00516.90
8.2.240.0100.00618.73
8.2.230.0080.00022.58
8.2.220.0060.00324.06
8.2.210.0080.00026.77
8.2.200.0110.00018.16
8.2.190.0000.01617.00
8.2.180.0000.01525.92
8.2.170.0040.01119.09
8.2.160.0070.00722.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0030.00526.16
8.2.120.0040.00421.05
8.2.110.0040.00422.25
8.2.100.0090.00317.91
8.2.90.0040.00419.20
8.2.80.0000.00817.97
8.2.70.0040.00417.86
8.2.60.0000.00818.15
8.2.50.0060.00318.07
8.2.40.0050.00318.16
8.2.30.0000.00818.07
8.2.20.0040.00420.51
8.2.10.0070.00018.14
8.2.00.0060.00319.31
8.1.330.0090.00921.76
8.1.320.0140.00616.41
8.1.310.0040.00817.02
8.1.300.0080.01119.48
8.1.290.0000.00930.84
8.1.280.0070.01025.92
8.1.270.0040.00423.99
8.1.260.0060.00326.35
8.1.250.0050.00228.09
8.1.240.0030.00621.96
8.1.230.0070.00419.11
8.1.220.0050.00317.78
8.1.210.0050.00318.77
8.1.200.0060.00317.36
8.1.190.0060.00317.48
8.1.180.0060.00318.10
8.1.170.0030.00518.49
8.1.160.0040.00418.91
8.1.150.0000.00818.61
8.1.140.0080.00017.53
8.1.130.0070.00017.47
8.1.120.0040.00417.51
8.1.110.0000.00817.46
8.1.100.0040.00417.44
8.1.90.0000.00717.49
8.1.80.0050.00617.49
8.1.70.0030.00717.47
8.1.60.0000.00817.61
8.1.50.0080.00017.61
8.1.40.0230.00417.45
8.1.30.0170.01117.63
8.1.20.0210.00717.55
8.1.10.0190.01117.59
8.1.00.0160.00817.37
8.0.300.0000.00718.77
8.0.290.0000.00817.18
8.0.280.0000.00818.46
8.0.270.0000.00716.78
8.0.260.0030.00316.92
8.0.250.0040.00416.97
8.0.240.0000.00717.04
8.0.230.0000.00717.08
8.0.220.0030.00317.00
8.0.210.0030.00317.00
8.0.200.0000.00716.96
8.0.190.0000.00816.93
8.0.180.0040.00416.89
8.0.170.0170.00616.94
8.0.160.0070.00716.84
8.0.150.0030.00616.99
8.0.140.0040.00816.91
8.0.130.0000.01016.92
8.0.120.0060.00716.95
8.0.110.0110.00716.87
8.0.100.0070.01016.83
8.0.90.0180.00416.82
8.0.80.0100.00316.84
8.0.70.0040.00816.96
8.0.60.0030.00716.97
8.0.50.0100.00016.88
8.0.30.0050.00516.87
8.0.20.0070.00916.87
8.0.10.0100.00317.07
7.4.330.0050.00015.55
7.4.320.0030.00316.67
7.4.300.0030.00316.49
7.4.290.0110.00516.43
7.4.280.0100.00516.63
7.4.270.0130.00016.63
7.4.260.0090.00916.46
7.4.250.0260.00016.57
7.4.240.0180.00516.62
7.4.230.0250.00316.62
7.4.220.0120.00816.63
7.4.210.0090.01216.62
7.4.200.0130.00716.49
7.4.190.0220.00016.56
7.4.180.0180.00316.71
7.4.160.0190.00416.49
7.4.150.0150.00716.54
7.4.140.0170.00416.48
7.4.130.0230.00016.36
7.4.120.0170.00716.56
7.4.110.0060.01616.48
7.4.100.0170.00616.53
7.4.90.0150.00816.57
7.4.80.0080.00816.38
7.4.70.0150.00616.41
7.4.60.0180.00316.34
7.4.50.0200.00616.40
7.4.40.0170.00916.42
7.4.30.0160.00516.48
7.4.20.0060.00916.38
7.4.10.0140.00316.45
7.4.00.0110.00316.44

preferences:
29.57 ms | 403 KiB | 5 Q