2
Test array_filter() function : usage variations - 'input' argument with different false entries
5
/* Prototype : array array_filter(array $input [, callback $callback])
6
* Description: Filters elements from the array via the callback.
7
* Source code: ext/standard/array.c
11
* With default callback function argument, array_filter() removes elements which are interpreted as false
12
* Here Testing all the false array element possibilities
15
// callback function always_true
16
function always_true($input)
21
// callback function always_false
22
function always_false($input)
27
echo "*** Testing array_filter() : usage variations - different false elements in 'input' ***\n";
33
// empty heredoc string
34
$empty_heredoc =<<<EOT
37
// input array with different false elements
57
// With default callback function
58
var_dump( array_filter($input) );
60
// With callback function which returns always true
61
var_dump( array_filter($input, 'always_true') );
63
// With callback function which returns always false
64
var_dump( array_filter($input, 'always_false') );
69
*** Testing array_filter() : usage variations - different false elements in 'input' ***