On Wed, 8 Jun 2011 09:46:26 -0300, Felipe Pena wrote:

It works in the same way:

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';
    }
}


OK, my mistake. I thought a property which holds a closure can be called directly.

Thanks for clarification.

Christian

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

Reply via email to