Are you also struggling with how to send arguments into the FILTER_CALLBACK.

Lets say you like to have a collection of custom filters that you can use in filter_var, filter_var_array and so on, but you want be able to call the new filters with different arguments, as you can in filter_var.

The easiest way to do this is to make a new class with all your custom filters. Then construct the class with your arguments inside filter_var argument array and enter the method in your class you like to run after.

If you send the argument as an array it is easy to make default values. But you can pass as many arguments you want and in any type, with this solution.

Here's how to create callable functions with parameters. These are functions that return closures. When you call them, you supply the known parameters, and it returns a function that will accept the value from filter_input() or filter_input_array().

The supplied callback function may also be a class method. (since 5.4.0 ?)To use a method you need to set the options param to an array with two values: the first is the object and the second is the method name.