1--TEST-- 2Test array_filter() function : basic functionality 3--FILE-- 4<?php 5echo "*** Testing array_filter() : basic functionality ***\n"; 6 7 8// Initialise all required variables 9$input = array(1, 2, 3, 0, -1); // 0 will be considered as FALSE and removed in default callback 10 11function even($input) 12{ 13 return ($input % 2 == 0); 14} 15 16// with all possible arguments 17var_dump( array_filter($input,"even") ); 18 19// with default arguments 20var_dump( array_filter($input) ); 21// same as with default arguments 22var_dump( array_filter($input, null) ); 23 24echo "Done" 25?> 26--EXPECT-- 27*** Testing array_filter() : basic functionality *** 28array(2) { 29 [1]=> 30 int(2) 31 [3]=> 32 int(0) 33} 34array(4) { 35 [0]=> 36 int(1) 37 [1]=> 38 int(2) 39 [2]=> 40 int(3) 41 [4]=> 42 int(-1) 43} 44array(4) { 45 [0]=> 46 int(1) 47 [1]=> 48 int(2) 49 [2]=> 50 int(3) 51 [4]=> 52 int(-1) 53} 54Done 55