3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = [ [ 'id' => 1, 'user_id' => 9788, 'contact_id' => 10083, 'product_id' => 1, 'category_id' => 23, 'grade' => 'A', 'point' => 89, ], [ 'id' => 1, 'user_id' => 9788, 'contact_id' => 10083, 'product_id' => 2, 'category_id' => 27, 'grade' => 'A', 'point' => 89, ] ]; $groupedArr = array_reduce($arr, function ($a, $c) { $a[$c['user_id']] = [ 'user_id' => $c['user_id'], 'contact_id' => $c['contact_id'], 'attributes' => array_merge([[ 'product_id' => $c['product_id'], 'category_id' => $c['category_id'] ]], $a[$c['user_id']]['attributes'] ?? []), 'grade' => $c['grade'], 'point' => $c['point'] ]; return $a; }, []); echo json_encode(array_values($groupedArr), JSON_PRETTY_PRINT);

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.5.70.0070.00918.63
8.5.60.0060.01116.80
8.5.50.0080.00716.48
8.5.30.0080.00917.33
8.5.20.0090.00919.63
8.5.10.0070.00920.38
8.5.00.0120.00920.21
8.4.210.0100.00719.67
8.4.180.0150.00819.83
8.4.170.0110.01020.50
8.4.160.0090.01220.67
8.4.150.0090.00316.91
8.4.140.0140.00717.55
8.4.130.0110.00818.85
8.4.120.0100.00620.63
8.4.110.0120.00818.89
8.4.100.0100.00817.91
8.4.90.0110.00920.54
8.4.80.0040.00418.93
8.4.70.0090.01020.82
8.4.60.0050.00420.38
8.4.50.0130.00718.67
8.4.40.0130.00619.55
8.4.30.0120.00618.68
8.4.20.0100.01017.83
8.4.10.0040.00422.05
8.3.300.0050.00419.38
8.3.290.0120.01020.82
8.3.280.0110.00818.43
8.3.270.0140.00616.84
8.3.260.0130.00616.61
8.3.250.0130.00616.69
8.3.240.0120.00816.62
8.3.230.0120.00816.80
8.3.220.0100.00620.77
8.3.210.0080.00818.72
8.3.200.0040.00516.63
8.3.190.0040.00419.03
8.3.180.0090.00919.25
8.3.170.0090.00917.36
8.3.160.0120.00616.74
8.3.150.0120.00616.70
8.3.140.0110.00716.71
8.3.130.0050.00316.57
8.3.120.0060.00319.00
8.3.110.0000.01120.94
8.3.100.0040.01218.45
8.3.90.0090.00926.77
8.3.80.0040.00716.50
8.3.70.0130.01016.58
8.3.60.0070.00718.31
8.3.50.0130.00720.09
8.3.40.0110.00320.04
8.3.30.0090.00618.66
8.3.20.0070.00024.18
8.3.10.0000.00824.66
8.3.00.0050.00326.16
8.2.300.0090.01020.37
8.2.290.0100.01017.31
8.2.280.0130.00620.12
8.2.270.0000.00816.72
8.2.260.0110.00717.15
8.2.250.0040.00416.40
8.2.240.0030.00618.25
8.2.230.0130.00622.58
8.2.220.0160.00324.06
8.2.210.0000.00826.77
8.2.200.0080.00016.75
8.2.190.0060.00918.38
8.2.180.0070.00725.92
8.2.170.0120.00918.91
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0080.00020.91
8.2.110.0070.00320.23
8.2.100.0060.00320.58
8.1.340.0120.01020.39
8.1.330.0090.01016.41
8.1.320.0070.01018.15
8.1.310.0180.00016.62
8.1.300.0080.00316.46
8.1.290.0060.00330.84
8.1.280.0180.00325.92
8.1.270.0030.01024.66
8.1.260.0060.00326.35
8.1.250.0080.00028.09
8.1.240.0040.00718.56
8.1.230.0100.00018.45
7.4.300.0060.00116.55

preferences:
78.83 ms | 893 KiB | 5 Q