__invoke() on callable Array or String
问题 How would one write PHP code to call all "Callables" with __invoke() ? The desire here is pass by reference, which is deprecated with call_user_func[_array]() . I did see that there is a package out there, TRex\Reflection\CallableReflection , but this seems to utilize call_user_func() in the background, and would suffer the same issue. <?php function passthrough_invoke(callable $callback) { return $callback->__invoke(); } function passthrough_user(callable $callback) { return call_user_func(