3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jsonString = '[{"id":1,"category":"Pizza","product":"Large Pizza","complement_type":"Bread","option":"Brown bread"},{"id":2,"category":"Pizza","product":"Small Pizza","complement_type":"Bread","option":"White bread"},{"id":3,"category":"Pizza","product":"Small Pizza","complement_type":"Ingredients","option":"Olives"},{"id":4,"category":"Salads","product":"Green Salad","complement_type":"Extras","option":"Bacon"},{"id":5,"category":"Salads","product":"Cesars Salad","complement_type":"Extras","option":"Lettuce"}]'; $array = json_decode($jsonString); $result = array(); foreach ($array as $row) { if (!isset($result[$row->category])) { $result[$row->category] = array(); } if (!isset($result[$row->category][$row->product])) { $result[$row->category][$row->product] = array(); } $result[$row->category][$row->product][$row->complement_type] = $row->option; } print_r($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.5.00.0100.01219.92
8.4.150.0030.00014.05
8.4.140.0090.01317.77
8.4.130.0100.01017.89
8.4.120.0090.01124.05
8.4.110.0110.00820.88
8.4.100.0110.01118.65
8.4.90.0110.00920.54
8.4.80.0150.00518.76
8.4.70.0110.00818.03
8.4.60.0080.00418.61
8.4.50.0080.00318.80
8.4.40.0140.00719.25
8.4.30.0000.00918.68
8.4.20.0160.00319.55
8.4.10.0090.00023.66
8.3.280.0100.01018.44
8.3.270.0100.00916.75
8.3.260.0130.00616.45
8.3.250.0130.00619.09
8.3.240.0110.00817.30
8.3.230.0140.00516.79
8.3.220.0060.00618.72
8.3.210.0130.00618.58
8.3.200.0040.00516.62
8.3.190.0060.00217.10
8.3.180.0120.00717.15
8.3.170.0120.00620.60
8.3.160.0060.01216.47
8.3.150.0130.00616.47
8.3.140.0000.00716.73
8.3.130.0000.00918.47
8.3.120.0040.00419.14
8.3.110.0080.00020.94
8.3.100.0160.00316.68
8.3.90.0040.00426.77
8.3.80.0090.00317.97
8.3.70.0040.01118.18
8.3.60.0120.00318.40
8.3.50.0100.01016.55
8.3.40.0100.00323.79
8.3.30.0000.01418.79
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0100.00820.31
8.2.280.0080.01118.31
8.2.270.0100.01017.31
8.2.260.0090.00616.98
8.2.250.0040.00416.64
8.2.240.0040.00418.88
8.2.230.0090.00622.58
8.2.220.0040.00424.06
8.2.210.0040.00426.77
8.2.200.0030.00616.63
8.2.190.0140.00718.34
8.2.180.0180.00317.00
8.2.170.0120.00322.96
8.2.160.0130.00322.96
8.2.150.0040.00425.66
8.2.140.0050.00324.66
8.2.130.0060.00926.16
8.2.120.0000.00726.16
8.2.110.0060.00322.29
8.2.100.0060.00618.03
8.2.90.0050.00318.03
8.2.80.0050.00319.13
8.2.70.0000.00917.63
8.2.60.0080.00017.63
8.2.50.0070.00018.05
8.2.40.0000.00819.48
8.2.30.0090.00417.84
8.2.20.0060.00617.85
8.2.10.0100.00717.71
8.2.00.0060.00617.69
8.1.330.0120.00721.67
8.1.320.0060.00416.12
8.1.310.0070.01118.42
8.1.300.0070.00316.20
8.1.290.0000.00930.84
8.1.280.0150.00625.92
8.1.270.0000.00724.66
8.1.260.0040.00426.35
8.1.250.0110.00428.09
8.1.240.0080.00020.84
8.1.230.0000.01020.88
8.1.220.0030.00517.79
8.1.210.0000.00818.77
8.1.200.0050.00517.23
8.1.190.0060.00317.35
8.1.180.0000.00818.10
8.1.170.0000.00717.62
8.1.160.0080.00817.52
8.1.150.0040.01217.48
8.1.140.0130.00317.38
8.1.130.0080.00817.35
8.1.120.0160.00017.51
8.1.110.0110.00617.52
8.1.100.0100.00517.46
8.1.90.0120.00517.51
8.1.80.0120.00417.55
8.1.70.0150.00317.50
8.1.60.0150.00417.72
8.1.50.0130.00517.50
8.1.40.0150.00317.54
8.1.30.0150.00517.59
8.1.20.0180.00017.59
8.1.10.0180.00017.56
8.1.00.0140.00517.53
8.0.300.0060.00319.95
8.0.290.0000.00816.75
8.0.280.0000.00716.95
8.0.270.0100.00516.96
8.0.260.0070.00716.85
8.0.250.0050.01016.88
8.0.240.0070.00716.91
8.0.230.0120.00216.91
8.0.220.0050.00916.92
8.0.210.0120.00216.90
8.0.200.0130.00316.86
8.0.190.0070.00716.87
8.0.180.0120.00216.82
8.0.170.0050.01016.82
8.0.160.0120.00316.77
8.0.150.0110.00416.76
8.0.140.0050.01016.89
8.0.130.0140.00016.74
8.0.120.0100.00516.86
8.0.110.0110.00316.89
8.0.100.0000.01516.77
8.0.90.0130.00216.91
8.0.80.0100.00616.75
8.0.70.0050.01016.84
8.0.60.0090.00616.73
8.0.50.0100.00316.84
8.0.30.0080.00816.89
8.0.20.0050.00516.98
8.0.10.0140.00016.96

preferences:
28.22 ms | 403 KiB | 5 Q