Re: [PHP] new keyword combined with other things...

2010-12-08 Thread Nathan Nobbe
On Wed, Dec 8, 2010 at 12:26 PM, Tommy Pham wrote: > > -Original Message- > > From: David Harkness [mailto:davi...@highgearmedia.com] > > Sent: Wednesday, December 08, 2010 10:46 AM > > To: Paul M Foster > > Cc: php-general@lists.php.net > > Subject:

RE: [PHP] new keyword combined with other things...

2010-12-08 Thread Tommy Pham
> -Original Message- > From: David Harkness [mailto:davi...@highgearmedia.com] > Sent: Wednesday, December 08, 2010 10:46 AM > To: Paul M Foster > Cc: php-general@lists.php.net > Subject: Re: [PHP] new keyword combined with other things... > > On Wed, Dec 8, 2010 a

Re: [PHP] new keyword combined with other things...

2010-12-08 Thread David Harkness
On Wed, Dec 8, 2010 at 9:31 AM, Paul M Foster wrote: > I agree. My advice for SQL is always to learn SQL rather than use a > bunch of active record functionality. But I'm sure people think I'm just > a curmudgeonly old turd. ;-} > Yes, absolutely learn SQL so you understand what's happening under

Re: [PHP] new keyword combined with other things...

2010-12-08 Thread Paul M Foster
On Wed, Dec 08, 2010 at 07:14:39AM -0800, Tommy Pham wrote: > On Tue, Dec 7, 2010 at 1:55 PM, Paul M Foster > wrote: > > > > $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'

Re: [PHP] new keyword combined with other things...

2010-12-08 Thread Tommy Pham
On Tue, Dec 7, 2010 at 1:55 PM, Paul M Foster wrote: > > $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 > I've never se

Re: [PHP] new keyword combined with other things...

2010-12-07 Thread David Harkness
On Tue, Dec 7, 2010 at 1:55 PM, Paul M Foster wrote: > Here is an example from their [CodeIgniter] user manual: > > $this->db->select('title')->from('mytable')->where('id', $id)->limit(10, > 20); > This is known as a "fluent interface" because it attempts to make your code read more naturally--i.

Re: [PHP] new keyword combined with other things...

2010-12-07 Thread Paul M Foster
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: > h

Re: [PHP] new keyword combined with other things...

2010-12-07 Thread Alexandru Patranescu
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. -> s

Re: [PHP] new keyword combined with other things...

2010-12-07 Thread Jim Lucas
On 12/7/2010 7:40 AM, Alexandru Patranescu wrote: > In many other languages this will work: > > *$result = new Object() -> method();* > > But in php, it fails at parsing. > I've tried with parenthesis around new but nothing. Anyhow, as I saw later, > *new* operator has precedence over others so t

Re: [PHP] new keyword combined with other things...

2010-12-07 Thread Gerardo Benitez
Try with $result = Object::method(); this is a static method in a class. the operator -> is access to a member in an object. Gerardo. On Tue, Dec 7, 2010 at 12:40 PM, Alexandru Patranescu wrote: > In many other languages this will work: > > *$result = new Object() -> method();* > > But

Re: [PHP] new keyword combined with other things...

2010-12-07 Thread Daniel P. Brown
On Tue, Dec 7, 2010 at 10:40, Alexandru Patranescu wrote: > > but is there any way to write it directly? and if not, why isn't this > implemented yet and when will it be? That kind of chaining has not yet been implemented in PHP --- but it's being discussed and voted now, as a matter of fact.