Re: Re: $arr = array('Hello', 'world'); $arr();
From: Christian Kaps Date: Wed, 08 Jun 2011 12:11:51 +0000 Subject: Re: Re: $arr = array('Hello', 'world'); $arr(); References: 1 2 Groups: php.internals Request: Send a blank email to [email protected] to get a copy of this message
On Wed, 8 Jun 2011 08:57:48 -0300, Felipe Pena wrote:Hi, 2011/6/8 Christian Kaps <[email protected]>Hi, I think for the sake of consistency it should be possible to use the following code. class Bar {Hi, what happens if I use this code. class Foo { public $bar; public function __construct() {Yes, the same rules.$this->bar = array($this, 'baz'); $this->bar();} public function bar() {echo 'bar';} public function baz() {echo 'baz';} } new Foo(); What is the output of this snippet? Are there the same rules as for closures? Christianpublic function __construct($dispatcher) {$dispatcher->addEventListener('onUpdate', $this->onUpdate); }public function onUpdate() {}} If a property $onUpdate exists then it will be ignored. The same rules as for Closures or for array callbacks. Christian
Thread (9 messages)
« previous | php.internals (#53207) | next » |
---|