3v4l.org

run code in 300+ PHP versions simultaneously
<?php $line_items = [ ['price' => 41.99, 'id' => 12, 'quantity' => 1], ['price' => 155.95, 'id' => 11, 'quantity' => 1], ['price' => 21, 'id' => 13, 'quantity' => 1] ]; $price_array = [ 197.94, 21.00 ]; var_export( array_reduce( $line_items, function($result, $row) use ($price_array) { $index = (int) array_key_last($result); $index += array_sum(array_column($result[$index] ?? [], 'price')) == $price_array[$index]; $result[$index][] = $row; return $result; }, [] ) );

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.120.0110.00920.40
8.4.110.0110.00922.44
8.4.100.0100.01117.95
8.4.90.0120.00917.77
8.4.80.0120.00518.03
8.4.70.0160.00617.78
8.4.60.0110.00717.80
8.4.50.0100.01017.82
8.4.40.0100.01020.25
8.4.30.0060.01218.89
8.4.20.0090.00019.51
8.4.10.0040.00422.30
8.3.250.0140.00518.88
8.3.240.0110.00816.79
8.3.230.0130.00616.69
8.3.220.0100.00817.42
8.3.210.0110.00616.60
8.3.200.0090.00916.60
8.3.190.0040.00416.57
8.3.180.0050.00316.69
8.3.170.0140.00318.78
8.3.160.0110.00718.46
8.3.150.0060.01017.04
8.3.140.0090.00616.81
8.3.130.0000.00918.35
8.3.120.0040.00420.80
8.3.110.0070.01120.94
8.3.100.0060.00316.63
8.3.90.0080.00026.77
8.3.80.0030.00619.36
8.3.70.0090.00916.63
8.3.60.0030.01318.30
8.3.50.0120.00616.56
8.3.40.0070.01420.14
8.3.30.0120.00318.88
8.3.20.0030.00524.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.290.0080.01020.72
8.2.280.0080.01016.66
8.2.270.0150.00416.61
8.2.260.0060.00919.11
8.2.250.0150.00318.39
8.2.240.0060.00319.06
8.2.230.0030.00622.58
8.2.220.0040.00424.06
8.2.210.0080.00026.77
8.2.200.0060.00318.88
8.2.190.0070.00718.30
8.2.180.0170.00316.50
8.2.170.0110.00418.96
8.2.160.0000.01322.96
8.2.150.0040.00425.66
8.2.140.0000.01024.66
8.2.130.0080.00026.16
8.2.120.0070.00026.16
8.2.110.0000.00922.07
8.2.100.0060.00617.72
8.2.90.0000.00817.75
8.2.80.0040.00418.86
8.2.70.0000.00917.75
8.2.60.0100.00017.93
8.2.50.0050.00318.07
8.2.40.0060.00618.22
8.2.30.0030.00317.97
8.2.20.0000.01517.54
8.2.10.0160.00017.63
8.2.00.0050.01117.75
8.1.330.0050.00616.84
8.1.320.0100.00816.30
8.1.310.0000.00816.63
8.1.300.0030.00617.89
8.1.290.0060.00330.84
8.1.280.0140.00025.92
8.1.270.0080.00024.66
8.1.260.0000.00826.35
8.1.250.0070.00328.09
8.1.240.0030.00620.32
8.1.230.0120.00017.83
8.1.220.0040.00417.79
8.1.210.0000.00918.77
8.1.200.0030.00617.48
8.1.190.0030.00617.35
8.1.180.0050.00318.10
8.1.170.0080.00018.59
8.1.160.0030.00917.43
8.1.150.0150.00217.30
8.1.140.0130.00317.38
8.1.130.0110.00517.47
8.1.120.0050.01117.49
8.1.110.0150.00017.49
8.1.100.0170.00017.58
8.1.90.0080.00817.42
8.1.80.0050.01017.45
8.1.70.0100.00517.36
8.1.60.0170.00017.52
8.1.50.0160.00417.48
8.1.40.0120.00617.61
8.1.30.0180.00017.59
8.1.20.0090.00617.66
8.1.10.0090.00617.70
8.1.00.0130.00717.45
8.0.300.0070.00018.77
8.0.290.0040.00416.63
8.0.280.0140.00016.87
8.0.270.0090.00416.71
8.0.260.0050.00916.90
8.0.250.0120.00516.79
8.0.240.0100.00516.86
8.0.230.0120.00316.77
8.0.220.0090.00516.80
8.0.210.0090.00516.72
8.0.200.0080.00816.78
8.0.190.0050.00516.87
8.0.180.0000.01216.88
8.0.170.0130.00016.84
8.0.160.0070.00716.73
8.0.150.0150.00016.81
8.0.140.0130.00216.81
8.0.130.0090.00616.76
8.0.120.0110.00716.84
8.0.110.0110.00416.75
8.0.100.0060.00616.82
8.0.90.0040.00816.77
8.0.80.0080.00416.79
8.0.70.0140.00416.81
8.0.60.0130.00016.77
8.0.50.0040.00916.66
8.0.30.0100.00716.79
8.0.20.0110.00416.74
8.0.10.0110.00416.91

preferences:
29.89 ms | 403 KiB | 5 Q