3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jsonData = '[{ "brand": {"id": "fe877b45-8620-453a-8805-63f0cbd80752", "name": "No Brand", "slug": "no-brand", "description": "null"}, "options": [{"id": "324af955-1aa9-42ea-be6e-bb4e5623a97a", "parent_id": "null", "name": "Need Insurance?"}, {"id": "73298c18-4ccc-4138-afa5-71d3d00dff9b", "parent_id": "null", "name": "Color", "slug": "color"}], "rating": [], "tags": [{"id": "8a31ee4c-3302-4357-9686-bd4308bbf39f", "name": "options", "slug": "options", "photo": "null"}], "variations": [{"id": "3bf5aeb9-9da2-4fb1-a3d2-f89eb75839c3", "parent_id": "null", "name": "Ram", "slug": "ram", "photo": "null"}, {"id": "e5c70766-a558-4539-b41f-77f72c819a7c", "parent_id": "null", "name": "cpu", "slug": "cpu", "photo": "null"}, {"id": "e63ac831-f595-4889-83d2-a5be65734758", "parent_id": "null", "name": "Monitor", "slug": "monitor"} ] }, { "brand": {"id": "fe877b45-8620-453a-8805-63f0cbd80752", "name": "No Brand", "slug": "no-brand", "description": null}, "options": [{"id": "522da418-eb3f-43e9-9392-63c941842a52", "parent_id": null, "name": "Color", "slug": "color-3"}], "rating": [], "tags": [], "variations": [{"id": "8e9a26c5-2ee4-4d86-9244-a10596d67fea", "parent_id": null, "name": "Cpu", "slug": "cpu-3", "photo": null}] } ] '; $jsonDataArr =json_decode($jsonData); $data = array(); foreach($jsonDataArr as $key => $items){ foreach($items as $innerKey => $eachItem){ if(!isset($data[$innerKey])){ $data[$innerKey] = array(); if(is_array($eachItem)){ foreach($eachItem as $each) if(!empty($each)) $data[$innerKey][] = (array) $each; }else{ if(!empty($eachItem)) $data[$innerKey][] = (array) $eachItem; } }else{ if(is_array($eachItem)){ foreach($eachItem as $each) if(!empty($each)) $data[$innerKey][] = (array) $each; }else{ if(!empty($eachItem)) $data[$innerKey][] = (array) $eachItem; } } } } foreach($data as $key => $val){ foreach($val as $l => $item){ $index = trim(strtolower($item['name'])); $data[$key][$index] = $item; unset($data[$key][$l]); } } foreach($data as $key => $val){ $data[$key]=array_values($val); } print_r($data);

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.130.0050.00517.91
8.4.120.0110.00920.79
8.4.110.0110.00718.96
8.4.100.0100.01217.73
8.4.90.0100.01020.51
8.4.80.0070.00518.81
8.4.70.0070.00918.83
8.4.60.0120.00918.69
8.4.50.0110.01018.70
8.4.40.0100.01017.75
8.4.30.0150.00620.40
8.4.20.0080.01219.64
8.4.10.0040.00422.41
8.3.250.0100.00917.26
8.3.240.0060.00216.52
8.3.230.0120.00816.66
8.3.220.0030.00518.85
8.3.210.0130.00616.61
8.3.200.0040.00516.66
8.3.190.0060.01119.11
8.3.180.0070.00519.16
8.3.170.0110.00716.79
8.3.160.0110.00818.77
8.3.150.0090.00916.70
8.3.140.0090.00618.86
8.3.130.0090.00018.28
8.3.120.0060.00318.86
8.3.110.0090.00020.94
8.3.100.0000.01124.06
8.3.90.0050.00526.77
8.3.80.0060.00316.63
8.3.70.0070.01116.58
8.3.60.0090.00616.75
8.3.50.0080.01023.73
8.3.40.0080.00818.78
8.3.30.0070.00718.71
8.3.20.0080.00024.18
8.3.10.0000.00824.66
8.3.00.0050.00326.16
8.2.290.0120.00717.27
8.2.280.0150.00418.31
8.2.270.0110.00716.90
8.2.260.0150.00416.54
8.2.250.0090.00616.50
8.2.240.0090.00017.23
8.2.230.0090.00622.58
8.2.220.0190.00037.54
8.2.210.0100.01026.77
8.2.200.0080.00016.50
8.2.190.0140.00416.58
8.2.180.0160.00625.92
8.2.170.0070.01418.91
8.2.160.0070.00722.96
8.2.150.0080.00025.66
8.2.140.0080.00324.66
8.2.130.0070.00026.16
8.2.120.0060.00319.36
8.2.110.0050.00519.27
8.2.100.0000.01117.84
8.2.90.0000.00818.16
8.2.80.0040.00418.16
8.2.70.0040.00417.63
8.2.60.0040.00417.50
8.2.50.0040.00418.05
8.2.40.0030.00518.14
8.2.30.0070.00018.16
8.2.20.0040.00418.18
8.2.10.0000.00719.27
8.2.00.0070.00019.38
8.1.330.0060.00317.66
8.1.320.0150.00518.32
8.1.310.0190.00016.12
8.1.300.0160.00417.78
8.1.290.0030.00618.88
8.1.280.0060.01225.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00619.59
8.1.230.0040.00821.04
8.1.220.0030.00517.77
8.1.210.0060.00319.06
8.1.200.0090.00017.47
8.1.190.0040.00417.23
8.1.180.0000.00918.10
8.1.170.0000.00818.68
8.1.160.0040.00418.85
8.1.150.0030.00518.96
8.1.140.0070.00018.84
8.1.130.0000.00720.09
8.1.120.0080.00317.47
8.1.110.0040.00417.30
8.1.100.0000.00817.47
8.1.90.0070.00017.47
8.1.80.0000.00717.48
8.1.70.0000.00817.45
8.1.60.0050.00317.58
8.1.50.0040.00417.50
8.1.40.0050.00317.56
8.1.30.0040.00417.53
8.1.20.0050.00517.66
8.1.10.0100.00317.54
8.1.00.0030.00517.54
8.0.300.0000.00719.98
8.0.290.0050.00316.63
8.0.280.0060.00318.39
8.0.270.0030.00317.94
8.0.260.0000.00818.45
8.0.250.0000.00716.84
8.0.240.0070.00016.85
8.0.230.0000.00717.00
8.0.220.0030.00316.80
8.0.210.0000.00716.91
8.0.200.0030.00316.95
8.0.190.0000.00717.00
8.0.180.0000.00816.95
8.0.170.0040.00417.00
8.0.160.0070.00016.91
8.0.150.0060.00316.80
8.0.140.0040.00416.91
8.0.130.0050.00013.31
8.0.120.0060.00316.86
8.0.110.0080.00016.78
8.0.100.0040.00416.86
8.0.90.0000.00716.94
8.0.80.0090.01316.92
8.0.70.0050.00216.82
8.0.60.0000.00816.97
8.0.50.0000.00716.86
8.0.30.0100.00617.22
8.0.20.0080.01017.04
8.0.10.0040.00416.84
8.0.00.0100.01016.82
7.4.330.0000.00415.55
7.4.320.0000.00716.54
7.4.300.0060.00016.45
7.4.290.0070.00016.63
7.4.280.0040.00416.61
7.4.270.0040.00416.59
7.4.260.0000.00716.59
7.4.250.0030.00316.43
7.4.240.0030.00316.52
7.4.230.0000.00716.50
7.4.220.0040.00416.57
7.4.210.0060.00916.56
7.4.200.0070.00016.48
7.4.130.0160.00316.63
7.4.120.0090.01316.45
7.4.110.0040.02116.68
7.4.100.0110.00716.43
7.4.90.0100.00716.52
7.4.80.0300.00416.52
7.4.70.0230.01516.57
7.4.60.0200.01216.58
7.4.50.0220.01116.45
7.4.40.0280.00816.55
7.4.30.0220.01516.57
7.4.20.0240.00916.46
7.4.10.0180.01516.51
7.4.00.0240.00416.59
7.3.330.0030.00516.41
7.3.320.0050.00013.26
7.3.310.0030.00316.43
7.3.300.0060.00016.27
7.3.290.0090.00616.37
7.3.280.0070.01116.23
7.3.260.0120.00716.52
7.3.240.0080.00916.50
7.3.230.0140.00716.43
7.3.210.0120.00616.42
7.3.200.0210.01816.36
7.3.190.0190.01516.80
7.3.180.0200.01216.55
7.3.170.0220.01416.66
7.3.160.0220.01316.32
7.3.150.0240.01216.63
7.3.140.0260.00716.39
7.3.130.0480.00716.56
7.3.120.0260.00416.40
7.3.110.0220.01016.47
7.3.100.0300.00416.32
7.3.90.0220.01416.44
7.3.80.0270.00616.32
7.3.70.0230.00716.36
7.3.60.0200.01216.51
7.3.50.0290.00516.48
7.3.40.0270.00616.32
7.3.30.0210.00916.41
7.3.20.0190.01516.36
7.3.10.0200.01716.38
7.3.00.0350.01216.43
7.2.330.0130.00516.60
7.2.320.0250.00616.48
7.2.310.0170.01416.74
7.2.300.0230.00916.63
7.2.290.0270.00816.59
7.2.280.0320.00516.70
7.2.270.0260.00916.76
7.2.260.0240.01216.59
7.2.250.0260.00616.30
7.2.240.0270.00716.53
7.2.230.0320.01116.77
7.2.220.0200.01016.62
7.2.210.0230.01216.44
7.2.200.0270.00916.51
7.2.190.0270.00616.73
7.2.180.0160.01616.71
7.2.170.0240.00816.81
7.2.160.0180.01416.81
7.2.150.0280.00816.85
7.2.140.0340.01016.73
7.2.130.0320.01216.60
7.2.120.0250.01916.81
7.2.110.0200.02116.59
7.2.100.0330.00816.80
7.2.90.0230.01516.61
7.2.80.0340.00816.80
7.2.70.0260.01316.60
7.2.60.0260.01216.58
7.2.50.0270.01216.49
7.2.40.0300.01516.79
7.2.30.0410.00016.73
7.2.20.0220.01916.68
7.2.10.0200.02016.68
7.2.00.0290.00916.49

preferences:
28.11 ms | 403 KiB | 5 Q