3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ "id" => 96, "shipping_no" => "212755-1", "part_no" => "reterty", "description" => "tyrfyt", "packaging_type" => "PC" ], [ "id" => 96, "shipping_no" => "212755-1", "part_no" => "dftgtryh", "description" => "dfhgfyh", "packaging_type" => "PC" ], [ "id" => 97, "shipping_no" => "212755-2", "part_no" => "ZeoDark", "description" => "s%c%s%c%s", "packaging_type" => "PC" ] ]; function getGroupedArray($array, $keyFieldsToGroup) { $newArray = array(); foreach ($array as $record) $newArray = getRecursiveArray($record, $keyFieldsToGroup, $newArray); return $newArray; } function getRecursiveArray($itemArray, $keys, $newArray) { if (count($keys) > 1) $newArray[$itemArray[$keys[0]]] = getRecursiveArray($itemArray, array_splice($keys, 1), $newArray[$itemArray[$keys[0]]]); else $newArray[$itemArray[$keys[0]]][] = $itemArray; return $newArray; } var_export( getGroupedArray($array, ['id', 'shipping_no']) );

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.10.0110.00819.68
8.5.00.0100.01120.45
8.4.150.0020.00014.05
8.4.140.0130.00817.88
8.4.130.0100.01018.52
8.4.120.0120.00824.01
8.4.110.0080.01117.95
8.4.100.0090.01118.75
8.4.90.0100.01022.43
8.4.80.0060.00418.82
8.4.70.0070.01118.03
8.4.60.0160.00618.72
8.4.50.0120.00720.21
8.4.40.0080.00018.99
8.4.30.0040.01124.24
8.4.20.0100.01019.73
8.4.10.0030.00619.49
8.3.280.0110.01118.65
8.3.270.0140.00717.00
8.3.260.0120.00716.86
8.3.250.0090.01019.00
8.3.240.0110.00817.39
8.3.230.0110.00816.87
8.3.220.0130.00518.75
8.3.210.0110.00716.64
8.3.200.0050.00416.89
8.3.190.0150.00417.04
8.3.180.0110.00718.90
8.3.170.0090.00917.29
8.3.160.0120.00618.63
8.3.150.0110.00719.16
8.3.140.0180.00018.65
8.3.130.0040.00416.64
8.3.120.0310.01016.56
8.3.110.0310.00616.37
8.3.100.0340.00716.52
8.3.90.0390.00916.67
8.3.80.0420.00416.59
8.3.70.0290.00016.46
8.3.60.0210.00416.52
8.3.50.0230.00016.60
8.3.40.0170.01317.59
8.3.30.0230.00917.28
8.3.20.0220.01217.11
8.3.10.0290.00617.27
8.3.00.0130.00517.56
8.2.290.0100.00720.67
8.2.280.0110.00420.36
8.2.270.0070.01116.74
8.2.260.0110.00717.02
8.2.250.0000.00817.09
8.2.240.0230.01016.62
8.2.230.0290.00416.29
8.2.220.0240.01716.39
8.2.210.0350.00716.41
8.2.200.0220.01316.77
8.2.190.0280.00816.39
8.2.180.0290.00916.45
8.2.170.0390.00417.86
8.2.160.0420.00017.61
8.2.150.0350.00617.82
8.2.140.0350.00717.22
8.2.130.0360.01417.59
8.2.120.0400.00817.79
8.2.110.0400.00317.29
8.2.100.0280.01317.65
8.2.90.0140.00917.54
8.2.80.0230.00917.48
8.2.70.0230.00717.43
8.2.60.0300.00817.44
8.2.50.0370.00417.53
8.2.40.0280.00917.65
8.2.30.0250.01317.48
8.2.20.0340.00417.51
8.2.10.0330.00717.42
8.2.00.0350.00317.37
8.1.330.0100.01122.06
8.1.320.0120.00716.15
8.1.310.0070.01116.79
8.1.300.0200.01616.29
8.1.290.0290.01116.05
8.1.280.0200.00715.89
8.1.270.0420.00617.28
8.1.260.0360.00717.22
8.1.250.0330.00717.23
8.1.240.0230.00817.37
8.1.230.0150.00917.43
8.1.220.0180.00317.44
8.1.210.0370.00417.32
8.1.200.0280.01317.15
8.1.190.0300.01317.05
8.1.180.0370.00417.17
8.1.170.0290.00917.15
8.1.160.0200.01717.07
8.1.150.0300.00816.86
8.1.140.0340.00916.98
8.1.130.0310.01117.09
8.1.120.0180.01817.23
8.1.110.0200.01617.17
8.1.100.0340.00317.11
8.1.90.0340.00417.25
8.1.80.0250.01217.17
8.1.70.0270.01017.09
8.1.60.0410.00017.30
8.1.50.0280.01217.21
8.1.40.0320.00617.36
8.1.30.0270.01417.18
8.1.20.0390.00317.28
8.1.10.0290.01117.27
8.1.00.0360.00317.26

preferences:
33.27 ms | 403 KiB | 5 Q