3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "type": "the type", "typesm": "type of", "entries": [ { "title": "title one", "body": "Original text", "image": "image 1 url", "time": "1558532690", "meta": { "mainColor": "#100a0e", "adSpace": null } }, { "title": "title two", "body": "Original text", "image": "image 1 url", "time": "1558515409", "meta": { "mainColor": "#100a0e", "adSpace": null } }]}'; $arr = json_decode($json, true); $arr['entries'] = array_column($arr['entries'], null, 'body'); foreach ($arr['entries'] as $ent){ echo $ent['image']. "\n"; echo $ent['title']. "\n"; echo $ent['body']. "\n"; } unset($ent); Echo "\n\n\n"; $arr = json_decode($json, true); foreach($arr['entries'] as $e){ $ent[$e['body'] . " " . $e['image']] = $e; } //$ent is now the new array with unique values of 'entries' foreach ($ent as $e){ echo $e['image'] . "\n"; echo $e['title'] . "\n"; echo $e['body'] . "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
image 1 url title two Original text image 1 url title two Original text

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:
71.3 ms | 401 KiB | 8 Q