Re: $arr = array('Hello', 'world'); $arr();

From: Date: Sun, 05 Jun 2011 20:01:55 +0000
Subject: Re: $arr = array('Hello', 'world'); $arr();
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-52962@lists.php.net to get a copy of this message
Hi, 2011/6/5 Zeev Suraski <zeev@zend.com> > > -----Original Message----- > > class Hello { > > public function world($x) { > > echo "Hello, $x\n"; return $this; > > } > > } > > > > $f = array(new Hello, 'foo'); > > $f(); > > Am I the only one who doesn't understand what this one is supposed to do..? > > If you are refering to the 'foo' method and the lack of arg, it's was a typo... The right one: <?php class Hello { public function world($x) { echo "Hello, $x\n"; return $this; } } $f = array(new Hello, 'world'); $f('devs'); -- Regards, Felipe Pena

« previous php.internals (#52962) next »