RE: [PHP] object literals
| From: | Robert Cummings | Date: | Sat, 02 May 2009 11:10:37 +0000 |
| Subject: | RE: [PHP] object literals | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-292214@lists.php.net to get a copy of this message | ||
On Sat, 2009-05-02 at 12:10 +0100, Ashley Sheridan wrote:
> On Sat, 2009-05-02 at 06:45 -0400, Robert Cummings wrote:
> > On Sat, 2009-05-02 at 12:39 +0200, Andrea Giammarchi wrote:
> > > exactly, why bother with JavaScript literal representation?
> > >
> > > the foreach loop was just an alternative to explicit object cast cause you did not
> > > like it .... I though it was more about control over what you want to cast and what you do not ...
> > > in any case, what I said does not change cause in php you have natural type hint over arrays and
> > > these are normally slightly faster so I do not get why you want objects rather than arrays ...
> >
> > It's not what I want, I'm not the original poster. Regardless though, it
> > comes down to the preference of the developer. It can certainly be
> > simpler to type:
> >
> > $obj->blah->bleh->bluh;
> >
> > than to type:
> >
> > $obj['blah']['bleh']['blug'];
> >
> > Cheers,
> > Rob.
> > --
> > http://www.interjinn.com
> > Application and Templating Framework for PHP
> >
> >
> Undefined index 'blug' in $obj on line 1 ;)
That is so weird... I got "Undefined variable: obj".
;)
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP