What does array_filter without a callback do?

If you read just a little further on the page to which you linked, you find, "If no callback is supplied, all entries of array equal to FALSE (see converting to boolean) will be removed."


Removes empty or equivalent values from array:

$entry = array(
    0 => 'foo',
    1 => false,
    2 => -1,
    3 => null,
    4 => '',
    5 => 0
);
    
print_r(array_filter($entry));

Result

Array
(
    [0] => foo
    [2] => -1
)

See the original documentation from the manual: Example #2 array_filter() without callback

Tags:

Php

Arrays