3v4l.org

run code in 300+ PHP versions simultaneously
<?php function recurse(&$array, $pid = null) { foreach ($array as $id => $item) { if (isset($item->params->data->menu_display_special) && $item->params->data->menu_display_special == 1) { unset($array[$id]); recurse($array, $item->id); } elseif ($item->parent_id === $pid) { unset($array[$id]); } } } $list = [ 35 => (object)[ 'id' => '2375', 'params' => (object)[ 'data' => (object)[ 'menu_display_special' => '1' ] ], 'parent_id' => '2376', 'parent' => false ], 36 => (object)[ 'id' => '2377', 'params' => (object)[ 'data' => (object)[ 'menu_display_special' => '1' ] ], 'parent_id' => '2376', 'parent' => false ], 37 => (object)[ 'id' => '2379', 'params' => (object)[ 'data' => (object)[ 'menu_display_special' => '1' ] ], 'parent_id' => '2377', 'parent' => false ], 38 => (object)[ 'id' => '2380', 'params' => (object)[ 'data' => (object)[ 'menu_display_special' => '1' ] ], 'parent_id' => '2377', 'parent' => false ], 39 => (object)[ 'id' => '2381', 'params' => (object)[ 'data' => (object)[] ], 'parent_id' => '2377', 'parent' => false ], 40 => (object)[ 'id' => '2378', 'params' => (object)[ 'data' => (object)[] ], 'parent_id' => '2376', 'parent' => false ], ]; recurse($list); var_export($list);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 40 => (object) array( 'id' => '2378', 'params' => (object) array( 'data' => (object) array( ), ), 'parent_id' => '2376', 'parent' => false, ), )

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