Re: Inconsistencies in callable, call_user_func and direct variable calls

From: Date: Thu, 19 Mar 2015 16:25:48 +0000
Subject: Re: Inconsistencies in callable, call_user_func and direct variable calls
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Thursday 19 March 2015 18:17:50 S.A.N wrote:
> > Then how would you write an callback containing an already constructed
> > object? $a = [$object, 'method'];
> > 
> > The alternative is unnecessarily cumbersome:
> > $a = function($methodArg1, $methodArg2) use($object) { return
> > $object->method($methodArg1, $methodArg2); };
> 
> $object->$methodName(...$args);

That's a call. Requested was an assignment. You cannot assign that and pass it 
around for later calling. You cannot pass that as a callable parameter.

Patrick


Thread (32 messages)

« previous php.internals (#85218) next »