2 /* Prototype : array array_filter(array $input [, callback $callback])
3 * Description: Filters elements from the array via the callback.
4 * Source code: ext/standard/array.c
8 * Passing 'input' array which contains elements as reference to other data
11 echo "*** Testing array_filter() : usage variations - 'input' containing references ***\n";
14 /* Prototype : bool callback(array $input)
15 * Parameter : $input - array of which each element need to be checked in function
16 * Return Type : returns true or false
17 * Description : This function checks each element of an input array if element > 5 then
18 * returns true else returns false
20 function callback($input)
30 // initializing variables
31 $value1 = array(1, 2, 8);
32 $value2 = array(5, 6, 4);
33 $input = array(&$value1, 10, &$value2, 'value');
35 // with 'callback' argument
36 var_dump( array_filter($input, 'callback') );
38 // with default 'callback' argument
39 var_dump( array_filter($input) );