Re: [PHP] Arrays: Comma at end?

2012-02-08 Thread Larry Garfield
On 2/7/12 1:50 PM, 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

Re: [PHP] Arrays: Comma at end?

2012-02-08 Thread Robert Cummings
On 12-02-07 02:50 PM, 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

Re: [PHP] Arrays: Comma at end?

2012-02-08 Thread Micky Hulse
On Wed, Feb 8, 2012 at 9:58 AM, Larry Garfield la...@garfieldtech.com wrote: Drupal's coding standards encourage the extra trailing comma on multi-line arrays, for all the readability and editability benefits that others have mentioned.  We have for years.  Cool stuff. :-) Yah, I love that

Re: [PHP] Arrays: Comma at end?

2012-02-08 Thread Micky Hulse
On Wed, Feb 8, 2012 at 10:08 AM, Robert Cummings rob...@interjinn.com wrote: JavaScript in Internet Crapsplorer spanks you on the bottom every time you have a trailing comma in a JS array. That may be where you picked up the aversion. On Wed, Feb 8, 2012 at 10:10 AM, Micky Hulse

Re: [PHP] Arrays: Comma at end?

2012-02-08 Thread Robert Cummings
On 12-02-08 01:12 PM, Micky Hulse wrote: On Wed, Feb 8, 2012 at 10:08 AM, Robert Cummingsrob...@interjinn.com wrote: JavaScript in Internet Crapsplorer spanks you on the bottom every time you have a trailing comma in a JS array. That may be where you picked up the aversion. On Wed, Feb 8,

[PHP] Arrays: Comma at end?

2012-02-07 Thread Micky Hulse
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

Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Ashley Sheridan
On Tue, 2012-02-07 at 11:50 -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

Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Paul M Foster
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

Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Micky Hulse
Hi Ashley! Thanks for your quick and informative reply, I really appreciate it. :) On Tue, Feb 7, 2012 at 12:10 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: It's easy to add and remove elements without making sure you have to check the trailing comma. It's also OK in Javascript to use

Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Ashley Sheridan
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:

Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Micky Hulse
On Tue, Feb 7, 2012 at 12:15 PM, Paul M Foster pa...@quillandmouse.com wrote: 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? Yah, ditto! :D In

Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Micky Hulse
On Tue, Feb 7, 2012 at 12:19 PM, Micky Hulse rgmi...@gmail.com wrote: Yah, ditto! :D $s = 'foo,bar,'; print_r(explode(',', $s)); The output is: Array ( [0] = foo [1] = bar [2] = ) That's one instance where I know you have to be cautious about the trailing delimiter. I know, this

Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Robert Williams
On 2/7/12 13:15, Paul M Foster pa...@quillandmouse.com wrote: 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? Nope. In fact, it's officially

Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Ashley Sheridan
On Tue, 2012-02-07 at 12:26 -0800, Micky Hulse wrote: On Tue, Feb 7, 2012 at 12:19 PM, Micky Hulse rgmi...@gmail.com wrote: Yah, ditto! :D $s = 'foo,bar,'; print_r(explode(',', $s)); The output is: Array ( [0] = foo [1] = bar [2] = ) That's one instance where I

Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Micky Hulse
On Tue, Feb 7, 2012 at 12:32 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: That's because it's not an array you've got the trailing delimiter on, it's a string. Right. Sorry, bad example. it was just the one example I could think of where you could get an empty element at the end of

Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Ghodmode
On Wed, Feb 8, 2012 at 4:10 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2012-02-07 at 11:50 -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? ... It's fine in PHP, and some coding practices