The array_filter() method filters the values of an array the usage of a callback function. This method passes each value of the input array to the callback function. If this callback function returns true then the current value from the input is returned into the result array.


array_filter(array, callbackfunction, flag)

  • array(Required)
  • callbackfunction(Optional)
  • flag(Optional)



function test_odd_number(int $var)
   return($var & 1);

Suggest An Answer