3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jsons=[ 'Single'=>'{"docID":451287,"list":{"id":77,"color":"pink"}}', 'Multiple'=>'{"docID":451287,"list":[{"id":85,"color":"blue"},{"id":47,"color":"red"},{"id":12,"color":"green"}]}' ]; foreach($jsons as $type=>$json){ $array=json_decode($json,true); if(isset($array['list']['color'])){ echo "Type = $type, Value = {$array['list']['color']}"; }else{ echo "Type = $type, Values = ",implode(', ',array_column($array['list'],'color')); } echo "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Type = Single, Value = pink Type = Multiple, Values = blue, red, green

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:
127.38 ms | 405 KiB | 5 Q