RE: [PHP-DEV] $arr = array('Hello', 'world'); $arr();
| From: | Zeev Suraski | Date: | Sun, 05 Jun 2011 20:09:39 +0000 |
| Subject: | RE: [PHP-DEV] $arr = array('Hello', 'world'); $arr(); | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52964@lists.php.net to get a copy of this message | ||
Ok, that makes much more sense. Given how everyone loved it I was beginning to wonder whether
I’ve become too old to understand simple pieces of code ☺
Zeev
From: Felipe Pena [mailto:felipensp@gmail.com]
Sent: Sunday, June 05, 2011 11:02 PM
To: Zeev Suraski
Cc: internals
Subject: Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();
Hi,
2011/6/5 Zeev Suraski <zeev@zend.com<mailto: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