1--TEST-- 2Test array_filter() function : usage variations - anonymous callback functions 3--FILE-- 4<?php 5/* 6* Passing different anonymous callback functions with passed by value and reference arguments 7*/ 8 9echo "*** Testing array_filter() : usage variations - Anonymous callback functions ***\n"; 10 11$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null); 12 13// anonymous callback function 14echo "Anonymous callback function with regular parameter and statement\n"; 15var_dump( array_filter($input, function($input) { return ($input > 1); }) ); 16 17// anonymous callback function with null argument 18echo "Anonymous callback function with null argument\n"; 19var_dump( array_filter($input, function() { return true; }) ); 20 21// anonymous callback function with argument and null statement 22echo "Anonymous callback function with regular argument and null statement\n"; 23var_dump( array_filter($input, function($input) { }) ); 24 25echo "Done" 26?> 27--EXPECT-- 28*** Testing array_filter() : usage variations - Anonymous callback functions *** 29Anonymous callback function with regular parameter and statement 30array(4) { 31 [3]=> 32 int(10) 33 [4]=> 34 int(100) 35 [5]=> 36 int(1000) 37 [6]=> 38 string(5) "Hello" 39} 40Anonymous callback function with null argument 41array(8) { 42 [0]=> 43 int(0) 44 [1]=> 45 int(1) 46 [2]=> 47 int(-1) 48 [3]=> 49 int(10) 50 [4]=> 51 int(100) 52 [5]=> 53 int(1000) 54 [6]=> 55 string(5) "Hello" 56 [7]=> 57 NULL 58} 59Anonymous callback function with regular argument and null statement 60array(0) { 61} 62Done 63