3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'a' => 'a', 'b' => '', 'c' => null, 'd' => 122, 'e' => 0, 'f' => [ 'g' => 'g', 'h' => 0, 'i' => null, 'j' => '' ] ]; $result = array_filter($array, function ($arr) { if (!is_array($arr)) { return strlen($arr) ; } return array_filter($arr) ; } ) ; $r = array_filter($array) ; var_dump($r);
Output for git.master_jit, git.master, rfc.property-hooks
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/Rb7Da on line 19 array(3) { ["a"]=> string(1) "a" ["d"]=> int(122) ["f"]=> array(4) { ["g"]=> string(1) "g" ["h"]=> int(0) ["i"]=> NULL ["j"]=> string(0) "" } }

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