PHP: How do you make a copy of a function and preset the arguments
Posted by trymeouteh@reddit | learnprogramming | View on Reddit | 2 comments
Is there something simular to call_user_func()
that will make a copy of the function and preset the arguments but will not call the function and instead just return a a copy of the function with the arugments preset?
BarneyLaurance@reddit
Sounds like you want partial function application. This was a proposed addition to the PHP language in 2020 but I'm afraid it was rejected - see https://wiki.php.net/rfc/partial_function_application .
mattgen88@reddit
I'd create a closure that will feed the presets when called