3v4l.org

run code in 300+ PHP versions simultaneously
<?php function hasNonEmptyArray(array $array): bool { foreach ($array as $k => $v) { if (is_array($v)) { if (hasNonEmptyArray($v)) { return true; // pass deeper true outcome up the call chain } } else { echo "Found element $k\n"; return true; } } return false; } $array = [ [ 'one' => [], 'two' => [ 'a' => [ 'foo' => [], ], 'b' => [] ], 'three' => [ 'c' => [ 'fizz' => 'buzz' ] ] ] ]; var_export(hasNonEmptyArray($array));
Output for git.master_jit, git.master
Found element fizz true

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