3v4l.org

run code in 500+ PHP versions simultaneously
<?php $stocks = collect( [ ['sku' => '123', 'batch' => '123', 'manufacturing_date' => 2021, 'qty_total' => 1], ['sku' => '123', 'batch' => '123', 'manufacturing_date' => 2021, 'qty_total' => 2], ['sku' => '123', 'batch' => '123', 'manufacturing_date' => 2020, 'qty_total' => 3], ['sku' => '5', 'batch' => '123', 'manufacturing_date' => 2020, 'qty_total' => 4], ] ); return $stocks->groupBy(['sku','batch' , 'manufacturing_date'], true)->map(function($items){ $firstItem = $items->values()->first()->values()->first(); return collect($firstItem->first())->merge([ 'qty_total' => $firstItem->sum('qty_total') ]); })->values();

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.30.0070.01019.45
8.5.20.0060.00220.15
8.5.10.0120.00716.91
8.5.00.0110.01020.09
8.4.180.0140.00719.68
8.4.170.0140.01123.86
8.4.160.0120.01023.88
8.4.150.0080.00416.87
8.4.140.0090.01117.56
8.4.130.0120.00818.80
8.4.120.0130.00718.45
8.4.110.0060.00218.05
8.4.100.0090.01318.82
8.4.90.0100.01020.59
8.4.80.0130.00418.70
8.4.70.0060.00318.09
8.4.60.0080.01118.69
8.4.50.0130.01018.61
8.4.40.0160.00317.81
8.4.30.0120.00318.83
8.4.20.0100.01019.78
8.4.10.0080.01119.54
8.3.300.0120.00922.51
8.3.290.0110.01018.36
8.3.280.0120.01018.28
8.3.270.0110.00816.75
8.3.260.0100.00816.59
8.3.250.0160.00416.68
8.3.240.0140.00516.40
8.3.230.0060.00216.55
8.3.220.0090.00918.92
8.3.210.0080.00716.86
8.3.200.0050.00416.49
8.3.190.0100.00817.01
8.3.180.0070.01217.19
8.3.170.0160.00318.91
8.3.160.0080.00816.52
8.3.150.0110.00717.05
8.3.140.0060.01216.96
8.3.130.0050.00318.35
8.3.120.0030.00718.62
8.3.110.0040.00420.94
8.3.100.0070.00318.49
8.3.90.0130.00716.39
8.3.80.0220.01530.84
8.3.70.0300.00030.84
8.3.60.0240.00830.84
8.3.50.0000.01130.84
8.3.40.0260.00030.84
8.3.30.0180.00730.84
8.3.20.0150.00730.84
8.3.10.0200.00030.84
8.3.00.0300.00030.84
8.2.300.0190.00518.21
8.2.290.0100.01016.57
8.2.280.0120.00618.62
8.2.270.0110.00717.14
8.2.260.0040.00418.41
8.2.250.0080.00018.38
8.2.240.0130.00718.62
8.2.230.0040.00422.58
8.2.220.0090.00024.06
8.2.210.0070.00726.77
8.2.200.0090.00430.84
8.2.190.0210.00530.84
8.2.180.0240.00430.84
8.2.170.0200.01230.84
8.2.160.0300.00730.84
8.2.150.0280.00730.84
8.2.140.0480.00330.84
8.2.130.0360.00630.84
8.2.120.0220.01230.84
8.2.110.0150.01030.84
8.2.100.0190.00530.84
8.2.90.0230.00030.84
8.2.80.0150.00930.84
8.2.70.0170.00430.84
8.2.60.0200.00030.84
8.2.50.0220.00030.84
8.2.40.0110.00830.84
8.2.30.0190.00330.84
8.2.20.0140.00830.84
8.2.10.0170.00630.84
8.2.00.0130.01030.84
8.1.340.0140.00918.11
8.1.330.0120.00716.38
8.1.320.0110.00918.10
8.1.310.0110.00716.69
8.1.300.0140.00317.77
8.1.290.0110.01130.84
8.1.280.0130.00930.84
8.1.270.0210.00730.84
8.1.260.0220.00030.84
8.1.250.0090.00930.84
8.1.240.0170.00030.84
8.1.230.0100.00730.84
8.1.220.0050.01030.84
8.1.210.0090.00630.84
8.1.200.0190.00630.84
8.1.190.0110.00730.84
8.1.180.0080.00830.84
8.1.170.0130.00430.84
8.1.160.0100.00730.84
8.1.150.0120.00830.84
8.1.140.0140.00330.84
8.1.130.0110.00930.84
8.1.120.0080.00830.84
8.1.110.0110.00430.84
8.1.100.0160.00330.84
8.1.90.0150.00430.84
8.1.80.0090.00930.84
8.1.70.0170.00330.84
8.1.60.0180.00330.84
8.1.50.0140.00530.84
8.1.40.0090.00930.84
8.1.30.0140.00330.84
8.1.20.0240.00030.84
8.1.10.0120.00630.84
8.1.00.0160.00630.84

preferences:
62.5 ms | 989 KiB | 5 Q