News for hackers. Stuff that matters.
Re:Moving from Go to PHP Again by ddtaylor on Friday February 08, 2019 @04:53AM (#19112815)
> - 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.

Re:Moving from Go to PHP Again by sandreas on Friday February 08, 2019 @07:47AM (#19113637)
With 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...