3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ (object) ['id' => 1, 'category' => 'Pizza', 'product' => 'Large Pizza', 'complement_type' => 'Bread', 'option' => 'Brown bread'], (object) ['id' => 2, 'category' => 'Pizza', 'product' => 'Small Pizza', 'complement_type' => 'Bread', 'option' => 'White bread'], (object) ['id' => 3, 'category' => 'Pizza', 'product' => 'Small Pizza', 'complement_type' => 'Ingredients', 'option' => 'Olives'], (object) ['id' => 4, 'category' => 'Salads', 'product' => 'Green Salad', 'complement_type' => 'Extras', 'option' => 'Bacon'], (object) ['id' => 5, 'category' => 'Salads', 'product' => 'Cesars Salad', 'complement_type' => 'Extras', 'option' => 'Lettuce'], ]; $result = []; foreach ($array as $obj) { $result[$obj->category][$obj->product][$obj->complement_type] = $obj->option; } var_export($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.0090.01020.45
8.4.110.0130.00822.22
8.4.100.0120.01017.81
8.4.90.0030.00618.47
8.4.80.0060.00317.97
8.4.70.0090.00317.82
8.4.60.0110.00918.70
8.4.50.0150.00717.61
8.4.40.0090.00624.07
8.4.30.0080.00018.95
8.4.20.0120.00617.95
8.4.10.0060.00323.80
8.3.250.0100.00818.64
8.3.240.0140.00616.77
8.3.230.0080.01016.61
8.3.220.0100.00917.42
8.3.210.0140.00416.76
8.3.200.0050.00416.58
8.3.190.0050.00316.95
8.3.180.0120.00718.20
8.3.170.0090.00920.71
8.3.160.0070.01016.90
8.3.150.0120.00616.70
8.3.140.0040.00417.08
8.3.130.0030.00616.90
8.3.120.0050.00519.11
8.3.110.0040.00420.94
8.3.100.0040.00424.06
8.3.90.0150.00026.77
8.3.80.0050.00518.30
8.3.70.0040.01518.43
8.3.60.0110.01118.43
8.3.50.0100.00716.73
8.3.40.0060.01323.66
8.3.30.0120.00918.53
8.3.20.0080.00024.18
8.3.10.0050.00224.66
8.3.00.0050.00226.16
8.2.290.0090.00820.35
8.2.280.0100.00920.68
8.2.270.0140.00416.57
8.2.260.0040.00416.62
8.2.250.0170.00316.73
8.2.240.0060.00317.12
8.2.230.0080.00022.58
8.2.220.0060.00637.54
8.2.210.0080.00026.77
8.2.200.0060.00318.40
8.2.190.0150.00616.63
8.2.180.0040.01116.72
8.2.170.0120.00618.91
8.2.160.0120.00922.96
8.2.150.0000.00825.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00026.16
8.2.110.0090.00021.00
8.2.100.0120.00018.03
8.2.90.0090.00318.03
8.2.80.0050.00319.06
8.2.70.0080.00417.75
8.2.60.0040.00417.63
8.2.50.0040.00417.75
8.2.40.0030.00619.47
8.2.30.0030.01017.70
8.2.20.0080.00317.80
8.2.10.0060.00817.86
8.2.00.0110.00217.82
8.1.330.0100.00821.95
8.1.320.0050.00316.26
8.1.310.0070.00718.18
8.1.300.0050.00318.45
8.1.290.0060.00330.84
8.1.280.0170.00325.92
8.1.270.0040.00424.66
8.1.260.0030.00626.35
8.1.250.0070.00028.09
8.1.240.0090.00022.19
8.1.230.0110.00020.95
8.1.220.0000.00817.74
8.1.210.0050.00318.79
8.1.200.0050.00317.48
8.1.190.0050.00317.38
8.1.180.0050.00318.10
8.1.170.0040.00417.62
8.1.160.0090.00417.38
8.1.150.0100.00417.35
8.1.140.0090.00517.44
8.1.130.0090.00517.46
8.1.120.0120.00317.50
8.1.110.0140.00117.41
8.1.100.0100.00517.46
8.1.90.0130.00017.40
8.1.80.0090.00417.51
8.1.70.0120.00217.47
8.1.60.0170.00217.68
8.1.50.0120.00517.56
8.1.40.0140.00217.61
8.1.30.0090.00617.59
8.1.20.0130.00417.54
8.1.10.0130.00317.50
8.1.00.0110.00617.45
8.0.300.0040.00420.00
8.0.290.0070.00016.88
8.0.280.0110.00416.90
8.0.270.0090.00616.83
8.0.260.0070.00716.87
8.0.250.0110.00416.97
8.0.240.0120.00316.85
8.0.230.0110.00716.89
8.0.220.0100.00816.79
8.0.210.0070.00716.81
8.0.200.0100.00316.87
8.0.190.0070.00517.00
8.0.180.0070.00316.93
8.0.170.0000.01116.88
8.0.160.0070.00616.86
8.0.150.0080.00416.85
8.0.140.0100.00216.83
8.0.130.0050.00816.85
8.0.120.0090.00316.83
8.0.110.0060.00616.80
8.0.100.0070.00416.75
8.0.90.0080.00316.85
8.0.80.0120.00016.83
8.0.70.0100.00416.82
8.0.60.0110.00416.79
8.0.50.0130.00316.86
8.0.30.0120.00316.80
8.0.20.0110.00416.89
8.0.10.0070.00817.03

preferences:
27 ms | 403 KiB | 5 Q