Re: Arrays: Comma at end?
| From: | Ashley Sheridan | Date: | Tue, 07 Feb 2012 20:18:03 +0000 |
| Subject: | Re: Arrays: Comma at end? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316541@lists.php.net to get a copy of this message | ||
On Tue, 2012-02-07 at 15:15 -0500, Paul M Foster wrote:
> On Tue, Feb 07, 2012 at 11:50:45AM -0800, Micky Hulse wrote:
>
> > Was there ever a time when having a comma at the end of the last array
> > element was not acceptable in PHP?
> >
> > I just did a few quick tests:
> >
> > <https://gist.github.com/1761490>
> >
> > ... and it looks like having that comma ain't no big deal.
> >
> > I can't believe that I always thought that having the trailing comma
> > was a no-no in PHP (maybe I picked that up from my C++ classes in
> > college? I just don't remember where I picked up this (bad) habit).
> >
> > I would prefer to have the trailing comma... I just can't believe I
> > have avoided using it for all these years.
> >
> > Thanks!
> > Micky
>
> I've always avoided trailing array commas, but only because I was under
> the impression that leaving one there would append a blank array member
> to the array, where it might be problematic. Yes? No?
>
> Paul
>
> --
> Paul M. Foster
> http://noferblatz.com
> http://quillandmouse.com
>
I've never experienced any blank elements in my arrays, maybe that was a
bug that only existed in very specific scenarios?
--
Thanks,
Ash
http://www.ashleysheridan.co.uk