On Wed, Jun 8, 2011 at 2:46 PM, Felipe Pena <felipe...@gmail.com> wrote:
> class foo {
>   public function __construct() {
>      $this->bar = function () { return 1; };
>      // $this->bar(); // error
>      $x = $this->bar;
>      $x(); // ok
>
>      $this->bar = array($this, 'baz');
>      // $this->bar(); // error
>      $x = $this->bar;
>      $x(); // ok
>   }
>   public function baz() {
>      echo 'baz';
>    }
> }

What he meant was passing an existing method as a callback if you
don't invoke it, i.e. passing "$this->bar" instead of array($this,
"bar"). I don't know how hard it'd be to achieve, but it sounds pretty
awesome to me.

Cheers

-- 
Jordi Boggiano
@seldaek :: http://seld.be/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to