Re: Arrays: Comma at end?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 8, 2012 at 4:10 AM, Ashley Sheridan
<ash@xxxxxxxxxxxxxxxxxxxx> 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 actually encourage it, for
> example:
...
>
> 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 the trailing
> comma, as long as you don't mind things not working on IE, which is the
> only browser that has issues with it. As far as PHP goes though, it's
> fine.

I believe this behavior was inherited from Perl.  I used Perl before I
used PHP and it was considered a feature for exactly the reason Ash
gave.

I think that problems with Perl may have originally inspired the
creation of PHP, at least in part.  But they kept the good parts.
This is just my perception.  To confirm it, I'd have to ask our BDFL
:)

--
Vince Aggrippino
a.k.a. Ghodmode
http://www.ghodmode.com


> --
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux