$myArray = [22, true, '', ['string', false], true];
function array_filter_recursive($myArray)
{
foreach ($myArray as &$value){
if (is_array($value))
$value = array_filter_recursive($value);
}
return array_filter($myArray);
}
echo '<pre>', print_r(array_filter_recursive($myArray), 1);
Возвращает:
Array
(
[0] => 22
[1] => 1
[3] => Array
(
[0] => string
)
[4] => 1
)
_____________
echo '<pre>',print_r($var, 1);die;
root@server# make love && war