How to pass variables to a function argument using add_action [duplicate]

Take a look into this example:

add_filter('some_hook', $callback = function( $arg ) use ( $values ){
    //Some calculation here
});

You can set arguments this way, and also use the predefined variables that exist outside the functions scope, by using the use() term.

This way, you can unhook the function wherever you want, by doing this:

remove_filter('some_hook', $callback);