3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[{ "11111111": { "id": "val_somevalue5555", "customer": { "32312": { "name": "jane doe" } } }, "2222222": { "id": "val_somevalue25", "customer": { "32312234": { "name": "jane doe" } } } }]'; $jsonarr = json_decode($json, true); $newarr = []; foreach($jsonarr[0] as $key => $value) { $newarr[] = ['key' => $key, 'id' => $value['id']]; } var_dump($newarr);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(2) { ["key"]=> int(11111111) ["id"]=> string(17) "val_somevalue5555" } [1]=> array(2) { ["key"]=> int(2222222) ["id"]=> string(15) "val_somevalue25" } }

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:
116.48 ms | 406 KiB | 5 Q