3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( array ( 'name' => 'menus', 'route' => 'admin.menu', 'parent_id' => null, ), array ( 'name' => 'users', 'route' => 'users', 'parent_id' => 0, ), array ( 'name' => 'roles', 'route' => 'roles', 'parent_id' => 0, ), array ( 'name' => 'testmenu-3', 'route' => 'testmenu-3', 'parent_id' => 1, ), array ( 'name' => 'testmenu-5', 'route' => 'testmenu-5', 'parent_id' => 1, ), array ( 'name' => 'testmenu-6', 'route' => 'testmenu-6', 'parent_id' => 0, ) ); $keys = array_keys($array); array_multisort( array_column($array, 'parent_id'), SORT_ASC, SORT_NUMERIC, $array, $keys ); $array = array_combine($keys, $array); $parent = $array[0]['name']; $out = array(); $pid = 0; $space = ''; unset($array[0]); foreach($array as $key => $val){ if($pid != $val['parent_id']){ $pid = $val['parent_id']; $space .= '&nbsp;&nbsp;&nbsp;&nbsp;'; } echo $space.$val['name']."<br/>"; }
Output for git.master, git.master_jit, rfc.property-hooks
roles<br/>testmenu-6<br/>users<br/>&nbsp;&nbsp;&nbsp;&nbsp;testmenu-3<br/>&nbsp;&nbsp;&nbsp;&nbsp;testmenu-5<br/>

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