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 pa...@quillandmouse.com 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

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 pa...@quillandmouse.com 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

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 pa...@quillandmouse.comwrote: 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

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 at 9:31 AM, Paul M Foster pa

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 tommy...@gmail.com 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

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

2010-12-07 Thread Alexandru Patranescu
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 this couldn't be a solution. I know a static function can be

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 dreal...@gmail.com 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

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 dreal...@gmail.comwrote: In many other languages this will work: *$result = new Object() -

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 this

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. -

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:

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 pa...@quillandmouse.comwrote: 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