3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array("A" => "aa", "B" => ["A" => "aaa", "B" => "bb"], "C" => "cc", "D" => ["E" =>"ee"]); function array_filter_recursive(array &$array, callable $callback) { foreach ($array as $key => &$value) { if ($callback($key, $value)) unset($array[$key]); else if (is_array($value)) array_filter_recursive($value, $callback); } } function sanitizedArray(&$arr, $restrictedProperties) { foreach($restrictedProperties as $prop) { array_filter_recursive($arr, function($k, $v) use ($prop) {return $prop == $k;}); } } sanitizedArray($arr, ["D"]); print_r($arr);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [A] => aa [B] => Array ( [A] => aaa [B] => bb ) [C] => cc )

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