3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 0 => array (0 => null, 1=> 'something1'), 1 => array (0 => null, 1=> null, 2 => 'something2', 3 => array(0 => null, 1 => 'f')), 2 => null ); function filterNulls($array, &$list = []) { array_walk($array, function ($value, $key) use (&$list) { if (!is_array($value)) { if (!empty($value)) { $list[$key] = $value; } } else { $list[$key] = filterNulls($value); } }); return $list; } print_r(filterNulls($array));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [1] => something1 ) [1] => Array ( [2] => something2 [3] => Array ( [1] => f ) ) )

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