3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'a' => 'a', 'b' => null, 'c' => array( 'a' => null, 'b' => 'b', ), 'd' => array( 'a' => null ) ); $result = array_walk_recursive_delete($array, function ($value, $key) { if (is_array($value)) { return empty($value); } }); echo"<pre>"; print_r($result); echo"<pre>"; function array_walk_recursive_delete(array &$array, callable $callback) { foreach ($array as $key => &$value) { if (is_array($value)) { $value = array_walk_recursive_delete($value, $callback); } if ($value == null) { unset($array[$key]); } } return $array; }
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [a] => a [c] => Array ( [b] => b ) ) <pre>

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