3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array("farm" => array("animals"=> array("horses" => array("fred" => "fred", "sam" => "sam", "alan" => "alan", "john" => "john") ) ) ); $search = 'horses'; get_values($arr); function get_values($arr){ global $search; foreach($arr as $key => $value){ if($key == $search){ if(is_array($value)){ $keys = array_keys($value); if(count($keys) > 1){ for($i = 0; $i < count($keys); $i++){ echo '<a href="mypage.php?id=2&dir='.$keys[$i].'"><li>'.$keys[$i].'</li></a>'; } }else{ echo '<a href="mypage.php?id=2&dir='.$keys[0].'"><li>'.$keys[0].'</li></a>'; } } else{ echo $value; } }else{ get_values($value); } } } ?>
Output for git.master, git.master_jit, rfc.property-hooks
<a href="mypage.php?id=2&dir=fred"><li>fred</li></a><a href="mypage.php?id=2&dir=sam"><li>sam</li></a><a href="mypage.php?id=2&dir=alan"><li>alan</li></a><a href="mypage.php?id=2&dir=john"><li>john</li></a>

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