3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'website' => [ 'id' => 'one' ], 'children' => [ [ 'website' => [ 'id' => 'one.one' ], 'children' => [ [ 'website' => [ 'id' => 'one.one.one' ], 'children' => [ [ 'website' => [ 'id' => 'one.one.one.one' ], 'children' => [] ], [ 'website' => [ 'id' => 'one.one.one.two' ], 'children' => [] ] ] ], [ 'website' => [ 'id' => 'one.one.two' ], 'children' => [ [ 'website' => [ 'id' => 'one.one.two.one' ], 'children' => [] ], [ 'website' => [ 'id' => 'one.one.two.two' ], 'children' => [] ] ] ] ] ], [ 'website' => [ 'id' => 'one.two' ], 'children' => [ [ 'website' => [ 'id' => 'one.two.one' ], 'children' => [ [ 'website' => [ 'id' => 'one.two.one.one' ], 'children' => [] ], [ 'website' => [ 'id' => 'one.two.one.two' ], 'children' => [] ] ] ], [ 'website' => [ 'id' => 'one.two.two' ], 'children' => [ [ 'website' => [ 'id' => 'one.two.two.one' ], 'children' => [] ], [ 'website' => [ 'id' => 'one.two.two.two' ], 'children' => [] ] ] ] ] ] ] ] ]; function delete_entries(&$array, $ids_to_delete) { foreach ($array['children'] as $index => &$child) { if (in_array($child['website']['id'], $ids_to_delete)) { unset($array['children'][$index]); } delete_entries($child, $ids_to_delete); } } foreach ($array as &$arr) { delete_entries($arr, array('one.one.two', 'one.two.one')); } var_export($array);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'website' => array ( 'id' => 'one', ), 'children' => array ( 0 => array ( 'website' => array ( 'id' => 'one.one', ), 'children' => array ( 0 => array ( 'website' => array ( 'id' => 'one.one.one', ), 'children' => array ( 0 => array ( 'website' => array ( 'id' => 'one.one.one.one', ), 'children' => array ( ), ), 1 => array ( 'website' => array ( 'id' => 'one.one.one.two', ), 'children' => array ( ), ), ), ), ), ), 1 => array ( 'website' => array ( 'id' => 'one.two', ), 'children' => array ( 1 => array ( 'website' => array ( 'id' => 'one.two.two', ), 'children' => array ( 0 => array ( 'website' => array ( 'id' => 'one.two.two.one', ), 'children' => array ( ), ), 1 => array ( 'website' => array ( 'id' => 'one.two.two.two', ), 'children' => array ( ), ), ), ), ), ), ), ), )

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:
33.85 ms | 411 KiB | 5 Q