3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ 'a' => 'value a', 'b' => [ 1 => [], 2 => 'value b2', 3 => [ 'x' => 'value x', 'y' => [ 'value z', '' ] ], 'c' => '' ], 'c' => '' ]; function findEmpties($input, $currentLevel = null) { static $empties = []; foreach ($input as $key => $value) { $levelItem = $currentLevel ? "{$currentLevel}[{$key}]" : $key; if (empty($value)) { $empties['empty'][] = $levelItem; } else { if (is_array($value)) { findEmpties($value, $levelItem); } } } return $empties; } print_r(findEmpties($input));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [empty] => Array ( [0] => b[1] [1] => b[3][y][1] [2] => b[c] [3] => c ) )

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:
168.8 ms | 405 KiB | 5 Q