Re: method chaining
| From: | Terry McBride | Date: | Mon, 11 Nov 2002 18:53:27 +0000 |
| Subject: | Re: method chaining | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123858@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Ford, Mike [LSS]" <M.Ford@lmu.ac.uk>
To: "'Terry McBride'" <terry@boxitllc.com>;
<php-general@lists.php.net>
Sent: Monday, November 11, 2002 1:33 PM
Subject: RE: [PHP] method chaining
> Apologies for the previous truncated version of this -- dunno what
happened there!!
>
> > -----Original Message-----
> > From: Terry McBride [mailto:terry@boxitllc.com]
> > Sent: 11 November 2002 15:53
> >
> > I have a question about php and OO. I want to chain methods
> > together having
> > them performed on the results of the following method.
> > Meaning something
> > like $foo->get("bar")->getBaz().
> >
> > I get the following error from the script bellow.
> > Parse error: parse error, unexpected T_OBJECT_OPERATOR,
> > expecting ',' or ';'
> > in /usr/local/apache/php/testchain.php on line 47
> >
> > Anybody know why I can't do this? Anyway to make it it one statement
> > instead of $tmp = $foo->get("bar"); $tmp->getBaz(); -- lame --?
> > Is their a config setting or something?
>
> As already noted, this doesn't work currently -- however, as I understand
it, it does work in Zend Engine 2 and so should make an appearance in PHP 5.
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS, LS6 3QS, United Kingdom
> Email: m.ford@lmu.ac.uk
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
> it does work in Zend Engine 2, and so should make an appearance in PHP 5.
>