3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array(1, 2, array(3, 4, array(5, 6)), array()), 'machiel', array(array(8,9), array(), array(array(array()))) ); $clear_stuff = function($carry, $item) { if (!is_array($item)) { $carry[] = $item; } if (is_array($item) && count($item) > 0) { $result = array_reduce($item, $clear_stuff, array()); if (count($result) > 0) { $carry[] = $result; } } return $carry; } array_reduce($array, $clear_stuff, array());
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected 'array_reduce' (T_STRING) in /in/fcOUf on line 26
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING in /in/fcOUf on line 26
Process exited with code 255.

preferences:
195.74 ms | 1395 KiB | 64 Q