3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regions = array(); $regions[65] = array('id' => 65, 'parent_id' => 44, 'name' => "Shoreditch"); $regions[77] = array('id' => 77, 'parent_id' => 5, 'name' => "England"); $regions[100] = array('id' => 100, 'parent_id' => 0, 'name' => "Europe"); $regions[5] = array('id' => 5, 'parent_id' => 100, 'name' => "United Kingdom"); $regions[44] = array('id' => 44, 'parent_id' => 77, 'name' => "London"); $hierarchy = array(); function get_hierarchy($regions, $region_id = 0) { if (0 === $regions[$region_id]['parent_id']) { return $regions[$region_id]['name']; } get_hierarchy($regions, $regions[$region_id]['parent_id']); return $regions[$region_id]['name']; } var_dump(get_hierarchy($regions, 44));
Output for git.master, git.master_jit, rfc.property-hooks
string(6) "London"

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