The array_filter() function use to filters the elements of an array using a callback function.
This function accepts two parameters and one flag. The first parameter is required which is to be an array, the second parameter is optional which is to be a callback function if passed and the last flag is also optional. The flags names are ARRAY_FILTER_USE_KEY and ARRAY_FILTER_USE_BOTH. By default array_filter() function uses ARRAY_FILTER_USE_KEY flag to filter the array. The flags were added in PHP version 5.6.0.