Re: [PHP] Binding object instances to static closures

[email protected] (David Harkness)
Newsgroups php.general
Message-ID <CAO8qQLmG1nODaUXYnuyM_qKb7dziCLdS9sSn6tXvPWi_E87KBg@mail.gmail.com>
Thanks Nathaniel for the clarification about 5.4. We are still on 5.3 (and
that only recently), so 5.4 is a ways off in our production systems.
However, I'll read up on this since it may be useful in offline tools.

On Fri, May 31, 2013 at 11:52 AM, Nick Whiting <[email protected]>wrote:

> TestClass::testMethod(function($param){
>     var_dump($this === $param);
> });
>

I get why closures created inside static methods cannot be bound to an
instance . . . but those created *outside* an object method entirely *can*
be bound? That makes no sense! And yet it works.

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.