Re: new keyword combined with other things...
| From: | Paul M Foster | Date: | Tue, 07 Dec 2010 21:55:08 +0000 |
| Subject: | Re: new keyword combined with other things... | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309897@lists.php.net to get a copy of this message | ||
On Tue, Dec 07, 2010 at 11:01:09PM +0200, Alexandru Patranescu wrote:
> I know how to do it in other ways.
> I was just wondering why the simple new Object() -> method won't work. new
> operator has precedence over.......
> That must be the problem. -> is not an operator. Is not in this list:
> http://php.net/manual/en/language.operators.precedence.php
> That must be done. -> should be an operator!
I haven't followed this thread closely, but I see code like this in
CodeIgniter a lot. I don't code like this, but it appears that they only
write this kind of code using already instantiated objects. Here is an
example from their user manual:
$this->db->select('title')->from('mytable')->where('id',
$id)->limit(10,
20);
What kind of internal magic they use to make this work, I don't know. I
haven't examined their internals.
Paul
--
Paul M. Foster