3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = json_decode('{ "name": "", "type": "layout", "children": [ { "name": "", "type": "section", "children": [ { "name": "", "type": "row", "children": [ { "name": "", "type": "column", "props": { }, "children": [] }, { "type": "column", "children": [ { "type": "itemdata", "props": { "basevalue": "100" }, "children": [] } ] } ] } ] }]}',true); //print_r($arr); function getBaseValue($arr,$search_key){ $pending_calls = []; foreach($arr as $key => $value){ if(is_array($value)){ $pending_calls[] = $value; }else if($search_key === $key){ return $value; } } foreach($pending_calls as $call){ $returned_val = getBaseValue($call,$search_key); if($returned_val !== false) return $returned_val; } return false; } echo getBaseValue($arr,'basevalue');
Output for git.master, git.master_jit, rfc.property-hooks
100

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