--TEST-- Test array_filter() function : usage variations - using the array keys inside 'callback' --FILE-- 4; } var_dump( array_filter($input, 'dump2', true) ); echo "*** Testing array_filter() : usage variations - 'callback' expecting second argument ***\n"; var_dump( array_filter($small, 'dump', false) ); echo "*** Testing array_filter() with various use types ***\n"; $mixed = array(1 => 'a', 2 => 'b', 'a' => 1, 'b' => 2); var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_KEY)); var_dump(array_filter($mixed, 'is_numeric', 0)); var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH)); echo "Done" ?> --EXPECTF-- *** Testing array_filter() : usage variations - using array keys in 'callback' *** 0 = 0 1 = 1 2 = -1 3 = 10 4 = 100 5 = 1000 6 = Hello 7 = array(0) { } *** Testing array_filter() : usage variations - 'callback' filters based on key value *** array(3) { [5]=> int(1000) [6]=> string(5) "Hello" [7]=> NULL } *** Testing array_filter() : usage variations - 'callback' expecting second argument *** Warning: Missing argument 2 for dump() in %s on line %d Notice: Undefined variable: key in %s on line %d = 123 array(0) { } *** Testing array_filter() with various use types *** array(2) { [1]=> string(1) "a" [2]=> string(1) "b" } array(2) { ["a"]=> int(1) ["b"]=> int(2) } Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 array(0) { } Done