3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = json_decode('{ "list": [ { "Id": 398, "Product Title": "Banner", "Sku": "vb-13oz", "Short Description": "text", "Long Description": "text", "Cost": "0.95", "Price": "3.25", "Category": [{ "Id": 9, "Title": "Banners" }], "Attribute Sides": [{ "Id": 1, "Title": "1 Side" }], "Attribute Grommets": [ { "Id": 1, "Title": "Every 2\' All Sides" }, { "Id": 2, "Title": "Every 2\' Top and Bottom" }, { "Id": 3, "Title": "Every 2\' Left & Right" }, { "Id": 4, "Title": "4 Corners Only" }, { "Id": 5, "Title": "No Gromments" } ] } ] }', true); foreach($data['list'] as $key => $item) { $data['list'][$key]['Attribute Grommets'] = [ [ 'Id' => $item['Attribute Grommets'][0]['Id'], 'Title' => implode(' | ', array_column($item['Attribute Grommets'], 'Title')) ] ]; } echo json_encode($data, JSON_PRETTY_PRINT);
Output for git.master_jit, git.master, rfc.property-hooks
{ "list": [ { "Id": 398, "Product Title": "Banner", "Sku": "vb-13oz", "Short Description": "text", "Long Description": "text", "Cost": "0.95", "Price": "3.25", "Category": [ { "Id": 9, "Title": "Banners" } ], "Attribute Sides": [ { "Id": 1, "Title": "1 Side" } ], "Attribute Grommets": [ { "Id": 1, "Title": "Every 2' All Sides | Every 2' Top and Bottom | Every 2' Left & Right | 4 Corners Only | No Gromments" } ] } ] }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
48.62 ms | 407 KiB | 5 Q