Re: RFC: alternative callback syntax

From: Date: Wed, 19 Sep 2012 18:21:51 +0000
Subject: Re: RFC: alternative callback syntax
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-63169@lists.php.net to get a copy of this message
On 9/19/12 2:01 PM, Andrew Faulds wrote:
Some other ideas: $cb = (callable) $obj->bar;
Ah, but (callable) that won't work for global functions, since (callable) is a cast, and
(callable) is not usable as a cast (at least in 5.4.7): $a = (callable)'str'; // Parse error: syntax error, unexpected 'callable' (T_CALLABLE) This could work, and it makes sense to me at least.
     $cb = {mysql_real_escape_string};
     $cb = &{mysql_real_escape_string};
I'll add these possibilities to the RFC soon. Steve -- http://www.mrclay.org/

« previous php.internals (#63169) next »