On Mon, Jan 26, 2004 at 08:50:51AM -0600, Jay Blanchard wrote:
> Out of curiosity, and because I have never noted this in other
> languages, why doesn't an 'open' comma at the end of an array throw any
> kind of error? Is it because the comma denotes another element in the
> array even if nothing is their? For example
> 
> $arrBadInfo = array(
>               'stuff   ',
>               'morstuff',
>       );
> 
> does not throw an error - even syntactical - 

This is as a convenience to programmers.  Often arrays have things added
or removed as you're coding -- not having to worry about removing a
trailing comma for an element that is now the last one, or adding one to
previous elements when adding items to the list is a small but useful
timesaver.

Perl does this as well.  I'm not sure which other languages do, but I
like it.

-- 
[ joel boonstra | gospelcom.net ]

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

Reply via email to