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)], ]; $products = []; $i = 0; $totalweight = 0; $totalprice = 0; foreach ( $sample_data as $item_id => $values ) { $_product = $values['data']; $q = 1; while ( $values['quantity'] >= $q ) { $products[ $i ] = new stdClass; $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.0170.00317.63
8.4.120.0120.00920.82
8.4.110.0170.00520.52
8.4.100.0070.01317.99
8.4.90.0100.01117.60
8.4.80.0130.00717.79
8.4.70.0150.00417.70
8.4.60.0110.01020.36
8.4.50.0110.01117.88
8.4.40.0120.00920.43
8.4.30.0070.01420.43
8.4.20.0130.00720.64
8.4.10.0040.00424.46
8.3.260.0080.01016.59
8.3.250.0030.00519.20
8.3.240.0110.00816.58
8.3.230.0060.00316.61
8.3.220.0050.00417.09
8.3.210.0060.00216.67
8.3.200.0050.00316.91
8.3.190.0150.00417.04
8.3.180.0150.00616.70
8.3.170.0090.00016.55
8.3.160.0150.00318.66
8.3.150.0000.01918.50
8.3.140.0040.00417.31
8.3.130.0070.00716.74
8.3.120.0080.00018.94
8.3.110.0130.00620.94
8.3.100.0000.00924.06
8.3.90.0080.00026.77
8.3.80.0000.01416.50
8.3.70.0130.00316.63
8.3.60.0160.00316.38
8.3.50.0120.00919.84
8.3.40.0090.00919.13
8.3.30.0100.00719.13
8.3.20.0040.00424.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.290.0140.00520.36
8.2.280.0110.00720.18
8.2.270.0150.00417.08
8.2.260.0120.00316.56
8.2.250.0060.00316.86
8.2.240.0040.01217.16
8.2.230.0060.00622.58
8.2.220.0070.00337.54
8.2.210.0070.00726.77
8.2.200.0060.00317.00
8.2.190.0120.00316.58
8.2.180.0110.00725.92
8.2.170.0120.00319.08
8.2.160.0090.00622.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0060.00319.67
8.2.110.0110.00019.30
8.2.100.0070.00717.91
8.2.90.0040.00417.75
8.2.80.0040.00418.78
8.2.70.0060.00317.75
8.2.60.0000.00818.03
8.2.50.0000.00918.07
8.2.40.0080.00018.28
8.2.30.0000.00818.20
8.2.20.0000.00720.45
8.2.10.0040.00418.13
8.2.00.0060.00319.30
8.1.330.0120.00816.86
8.1.320.0100.00916.40
8.1.310.0130.00618.56
8.1.300.0000.00819.85
8.1.290.0050.00530.84
8.1.280.0070.01125.92
8.1.270.0080.00023.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00324.01
8.1.230.0040.00717.83
8.1.220.0000.00817.74
8.1.210.0090.00018.77
8.1.200.0060.00317.48
8.1.190.0030.00617.23
8.1.180.0050.00318.10
8.1.170.0030.00618.50
8.1.160.0070.00018.83
8.1.150.0040.00418.54
8.1.140.0000.00717.39
8.1.130.0030.00317.37
8.1.120.0040.00417.45
8.1.110.0070.00017.49
8.1.100.0000.00817.36
8.1.90.0000.00717.50
8.1.80.0090.00017.36
8.1.70.0020.00517.41
8.1.60.0040.00417.57
8.1.50.0000.00817.44
8.1.40.0170.00917.57
8.1.30.0090.00917.65
8.1.20.0110.01117.67
8.1.10.0150.01217.50
8.1.00.0200.00717.37
8.0.300.0040.00418.77
8.0.290.0050.00316.63
8.0.280.0040.00420.23
8.0.270.0070.00018.04
8.0.260.0000.00616.81
8.0.250.0030.00316.90
8.0.240.0000.00717.04
8.0.230.0000.00816.89
8.0.220.0000.00716.95
8.0.210.0030.00316.83
8.0.200.0050.00317.02
8.0.190.0050.00316.85
8.0.180.0080.00016.89
8.0.170.0140.00716.89
8.0.160.0140.00716.91
8.0.150.0140.00716.73
8.0.140.0080.01316.72
8.0.130.0210.00316.87
8.0.120.0050.00916.78
8.0.110.0180.00316.91
8.0.100.0210.00016.92
8.0.90.0080.00816.94
8.0.80.0060.00616.77
8.0.70.0120.00216.86
8.0.60.0000.01416.85
8.0.50.0100.00516.90
8.0.30.0040.01116.93
8.0.20.0040.00916.79
8.0.10.0000.01317.09
8.0.00.0080.00216.93
7.4.330.0030.00315.55
7.4.320.0000.00716.64
7.4.300.0070.00316.45
7.4.290.0100.00216.44
7.4.280.0210.00416.62
7.4.270.0200.00516.54
7.4.260.0150.00316.68
7.4.250.0220.00216.52
7.4.240.0190.00316.53
7.4.230.0160.00716.55
7.4.220.0050.01016.43
7.4.210.0000.00816.47
7.4.200.0150.00616.59
7.4.190.0160.00516.59
7.4.180.0190.00316.64
7.4.160.0210.00016.51
7.4.150.0160.00616.44
7.4.140.0190.00016.48
7.4.130.0140.00716.54
7.4.120.0130.00516.57
7.4.110.0100.00516.38
7.4.100.0200.00016.45
7.4.90.0130.00316.52
7.4.80.0120.00416.48
7.4.70.0090.00016.46
7.4.60.0040.00416.38
7.4.50.0080.00016.29
7.4.40.0030.00516.43
7.4.30.0040.00716.41
7.4.20.0090.00516.45
7.4.10.0120.00316.50
7.4.00.0140.00416.50
7.3.330.0110.01016.40
7.3.320.0170.00416.52
7.3.310.0180.00316.38
7.3.300.0160.00516.38
7.3.290.0140.00716.24
7.3.280.0160.00316.40
7.3.270.0100.01016.24
7.3.260.0200.00016.37
7.3.250.0120.00816.43
7.3.240.0180.00216.43
7.3.230.0110.01116.39
7.3.220.0210.00016.41
7.3.210.0160.00416.34
7.3.200.0160.00416.19
7.3.190.0180.00316.34
7.3.180.0160.00516.37
7.3.170.0160.00416.38
7.3.160.0130.00916.38
7.3.150.0150.00416.22
7.3.140.0100.01016.22
7.3.130.0160.00316.22
7.3.120.0160.00416.29
7.3.110.0180.00416.15
7.3.100.0170.00316.37
7.3.90.0190.00516.65
7.3.80.0210.00016.22
7.3.70.0130.00716.45
7.3.60.0160.00416.53
7.3.50.0150.00716.31
7.3.40.0200.00016.50
7.3.30.0160.00316.55
7.3.20.0110.00816.66
7.3.10.0140.00716.51
7.3.00.0130.00916.45
7.2.340.0140.00816.46
7.2.330.0100.01016.58
7.2.320.0120.00816.42
7.2.310.0100.01016.45
7.2.300.0100.01016.27
7.2.290.0160.00616.34
7.2.280.0180.00416.46
7.2.270.0180.00316.32
7.2.260.0160.00616.54
7.2.250.0150.00716.36
7.2.240.0140.00716.30
7.2.230.0130.01016.45
7.2.220.0180.00316.27
7.2.210.0100.01016.49
7.2.200.0200.00316.55
7.2.190.0170.00416.48
7.2.180.0160.00716.48
7.2.170.0130.00716.75
7.2.160.0170.00316.47
7.2.150.0090.01216.71
7.2.140.0170.00316.72
7.2.130.0180.00316.74
7.2.120.0150.00616.66
7.2.110.0180.00316.78
7.2.100.0180.00316.81
7.2.90.0180.00616.70
7.2.80.0180.00316.53
7.2.70.0160.00616.63
7.2.60.0210.00016.77
7.2.50.0170.00516.52
7.2.40.0190.00316.82
7.2.30.0250.00016.62
7.2.20.0180.00416.67
7.2.10.0300.00316.61
7.2.00.0170.00516.77
7.1.330.0200.00015.62
7.1.320.0110.00815.70
7.1.310.0220.00615.41
7.1.300.0200.00015.54
7.1.290.0160.00315.43
7.1.280.0150.00615.66
7.1.270.0170.00615.46
7.1.260.0170.00615.61
7.1.250.0170.00315.59
7.1.240.0140.00515.51
7.1.230.0170.00315.45
7.1.220.0100.01015.65
7.1.210.0190.00015.60
7.1.200.0120.00815.43
7.1.190.0170.00315.63
7.1.180.0180.00315.53
7.1.170.0160.00515.58
7.1.160.0170.00315.57
7.1.150.0120.00915.63
7.1.140.0180.00415.55
7.1.130.0160.00415.53
7.1.120.0100.01015.57
7.1.110.0180.00215.45
7.1.100.0120.00715.36
7.1.90.0280.00615.40
7.1.80.0200.00015.61
7.1.70.0140.00715.47
7.1.60.0170.00315.47
7.1.50.0160.00315.69
7.1.40.0100.01015.68
7.1.30.0130.00715.65
7.1.20.0150.00615.55
7.1.10.0140.00615.64
7.1.00.0210.00015.28
7.0.330.0120.00615.08
7.0.320.0170.00315.15
7.0.310.0150.00415.10
7.0.300.0140.00715.10
7.0.290.0180.00015.14
7.0.280.0120.00815.10
7.0.270.0170.00715.18
7.0.260.0160.00415.11
7.0.250.0130.00815.38
7.0.240.0130.00515.33
7.0.230.0160.00415.47
7.0.220.0100.01015.26
7.0.210.0130.00715.34
7.0.200.0150.00415.23
7.0.190.0130.00715.10
7.0.180.0160.00315.39
7.0.170.0170.00415.44
7.0.160.0190.00015.01
7.0.150.0120.00815.09
7.0.140.0120.00815.13
7.0.130.0120.00615.23
7.0.120.0090.00915.33
7.0.110.0150.00415.16
7.0.100.0110.00815.11
7.0.90.0110.00915.35
7.0.80.0170.00315.19
7.0.70.0170.00315.08
7.0.60.0200.00315.34
7.0.50.0150.00415.18
7.0.40.0150.00315.25
7.0.30.0160.00315.30
7.0.20.0170.00315.26
7.0.10.0150.00515.24
7.0.00.0170.00015.25
5.6.400.0160.00416.00
5.6.390.0200.00015.77
5.6.380.0140.00315.93
5.6.370.0140.00616.04
5.6.360.0160.00316.09
5.6.350.0090.00915.96
5.6.340.0110.00716.02
5.6.330.0170.00015.98
5.6.320.0160.00415.95
5.6.310.0130.00516.00
5.6.300.0190.00015.76
5.6.290.0140.00415.77
5.6.280.0120.00615.91
5.6.270.0120.00615.93
5.6.260.0110.00815.82
5.6.250.0130.00515.93
5.6.240.0090.00916.01
5.6.230.0120.00616.12
5.6.220.0120.00616.07
5.6.210.0140.00715.95
5.6.200.0160.00616.06
5.6.190.0150.00616.22
5.6.180.0140.00516.07
5.6.170.0160.00416.00
5.6.160.0150.00216.21
5.6.150.0130.00315.97
5.6.140.0160.00316.07
5.6.130.0150.00315.92
5.6.120.0120.00615.87
5.6.110.0160.00215.89
5.6.100.0100.00715.98
5.6.90.0160.00315.91
5.6.80.0120.00615.75
5.6.70.0130.00516.06
5.6.60.0140.00316.17
5.6.50.0150.00415.88
5.6.40.0180.00015.87
5.6.30.0170.00015.97
5.6.20.0170.00015.91
5.6.10.0110.00715.83
5.6.00.0120.00615.99
5.5.380.0090.00916.14
5.5.370.0120.00615.87
5.5.360.0130.00615.78
5.5.350.0170.00416.02
5.5.340.0120.00615.96
5.5.330.0070.01515.82
5.5.320.0150.00316.02
5.5.310.0150.00415.95
5.5.300.0160.00315.95
5.5.290.0150.00315.97
5.5.280.0090.00915.90
5.5.270.0190.00016.07
5.5.260.0120.00615.92
5.5.250.0140.00416.06
5.5.240.0140.00316.04
5.5.230.0110.00615.89
5.5.220.0120.00416.06
5.5.210.0110.00815.96
5.5.200.0110.00815.70
5.5.190.0110.00615.84
5.5.180.0190.00015.91
5.5.170.0100.00715.77
5.5.160.0150.00315.75
5.5.150.0180.00015.79
5.5.140.0110.00615.74
5.5.130.0120.00615.63
5.5.120.0160.00215.76
5.5.110.0140.00415.74
5.5.100.0070.01016.09
5.5.90.0100.00716.09
5.5.80.0140.00316.01
5.5.70.0130.00615.86
5.5.60.0140.00316.08
5.5.50.0110.00716.13
5.5.40.0210.00015.91
5.5.30.0140.00416.08
5.5.20.0110.00616.13
5.5.10.0120.00515.66
5.5.00.0100.00715.93
5.4.450.0110.00312.75
5.4.440.0070.00712.84
5.4.430.0110.00413.01
5.4.420.0080.00612.86
5.4.410.0050.01012.84
5.4.400.0110.00412.80
5.4.390.0080.00612.79
5.4.380.0100.00512.88
5.4.370.0160.00012.95
5.4.360.0100.00612.82
5.4.350.0160.00012.80
5.4.340.0110.00412.78
5.4.330.0110.00312.58
5.4.320.0100.00312.87
5.4.310.0150.00012.86
5.4.300.0130.00312.84
5.4.290.0080.00812.93
5.4.280.0130.00312.87
5.4.270.0110.00512.83
5.4.260.0110.00412.95
5.4.250.0120.00412.73
5.4.240.0140.00212.75
5.4.230.0110.00412.45
5.4.220.0150.00312.52
5.4.210.0090.00612.33
5.4.200.0120.00312.68
5.4.190.0110.00412.68
5.4.180.0090.00612.42
5.4.170.0130.00312.82
5.4.160.0110.00312.78
5.4.150.0080.00812.67
5.4.140.0110.00412.87
5.4.130.0080.00512.69
5.4.120.0120.00313.03
5.4.110.0100.00513.01
5.4.100.0090.00612.87
5.4.90.0090.00513.01
5.4.80.0110.00312.99
5.4.70.0150.00012.98
5.4.60.0050.01012.76
5.4.50.0070.00712.62
5.4.40.0100.00512.95
5.4.30.0100.00512.59
5.4.20.0100.00312.92
5.4.10.0110.00313.01
5.4.00.0100.00512.61
5.3.290.0140.00012.90
5.3.280.0110.00412.80
5.3.270.0130.00312.85
5.3.260.0150.00012.87
5.3.250.0150.00012.89
5.3.240.0090.00612.55
5.3.230.0090.00612.78
5.3.220.0120.00312.64
5.3.210.0130.00312.83
5.3.200.0140.00412.57
5.3.190.0070.00712.82
5.3.180.0150.00012.76
5.3.170.0150.00012.97
5.3.160.0130.00312.96
5.3.150.0150.00013.04
5.3.140.0120.00312.95
5.3.130.0090.00612.74
5.3.120.0100.00512.99
5.3.110.0110.00412.69
5.3.100.0110.00412.95
5.3.90.0150.00012.94
5.3.80.0090.00612.59
5.3.70.0110.00412.67
5.3.60.0130.00012.70
5.3.50.0060.01012.79
5.3.40.0110.00312.59
5.3.30.0140.00012.57
5.3.20.0080.00512.59
5.3.10.0110.00412.61
5.3.00.0090.00312.61
5.2.170.0090.00211.85
5.2.160.0080.00411.70
5.2.150.0060.00511.95
5.2.140.0050.00511.70
5.2.130.0060.00611.69
5.2.120.0080.00411.69
5.2.110.0060.00511.89
5.2.100.0050.00511.64
5.2.90.0030.00811.64
5.2.80.0070.00411.77
5.2.70.0070.00411.67
5.2.60.0110.00011.72
5.2.50.0120.00011.82
5.2.40.0090.00411.60
5.2.30.0080.00411.52
5.2.20.0040.00711.59
5.2.10.0070.00411.35
5.2.00.0120.00011.29
5.1.60.0110.00010.68
5.1.50.0070.00310.68
5.1.40.0100.00011.00
5.1.30.0100.00011.05
5.1.20.0070.00210.74
5.1.10.0100.00010.68
5.1.00.0090.00010.59
5.0.50.0040.00410.01
5.0.40.0080.00010.01
5.0.30.0080.00010.01
5.0.20.0000.00810.01
5.0.10.0000.00810.01
5.0.00.0050.00310.01
4.4.90.0030.00210.01
4.4.80.0000.00410.01
4.4.70.0060.00010.01
4.4.60.0050.00010.01
4.4.50.0050.00010.01
4.4.40.0050.00010.01
4.4.30.0000.00510.01
4.4.20.0050.00010.01
4.4.10.0000.00610.01
4.4.00.0000.00510.01
4.3.110.0000.00410.01
4.3.100.0040.00210.01
4.3.90.0020.00210.01
4.3.80.0050.00010.01
4.3.70.0050.00010.01
4.3.60.0040.00010.01
4.3.50.0050.00010.01
4.3.40.0050.00010.01
4.3.30.0040.00010.01
4.3.20.0040.00010.01
4.3.10.0000.00310.01
4.3.00.0000.00410.01

preferences:
35.98 ms | 403 KiB | 5 Q