3 ms·
> - the "callable" concept - call_user_func_array(["object", "method"]) For at nearly 10 years now PHP has had support for lambdas, meaning for most uses `$foo
by ddtaylor 8y ago
> - the "callable" concept - call_user_func_array(["object", "method"])
For at nearly 10 years now PHP has had support for lambdas, meaning for most uses `$foo()` can be used instead and with the inclusion of the spread operator it's seldom used.
- sandreas 8y agoWith the "callable" concept i meant, that many things are seen as callable: [$obj, "methodName"] => callable for $obj->methodName() "str_replace" => callable for function "str_replace" ["ClassName", "staticMethod"] => callable for ClassName::staticMethod() "ClassName::staticMethod" => callable for ClassName::staticMethod() function() {} => callable for a lambda I would prefer a "ClassMethod" and a "Function" type, instead of using strings. $x = phpinfo; $x(); $y = $obj->method; $y(); But i don't think, this is possible, because PHP supports global constants and function names cannot be distinguished from constants, especially because PHP is not case sensitive regarding functions and classnames. But I see, that my karma has decreased with this post, so it seems, that not many are in my opinion...