Re: IE7 => end tag?

From: Date: Fri, 18 May 2007 13:53:56 +0000
Subject: Re: IE7 => end tag?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-255131@lists.php.net to get a copy of this message
On 18/05/07, Jim Moseby <JMoseby@nrbindustries.com> wrote:
The extra comma at the end of the array definition is still valid syntax in PHP. Try for yourself: php -r '$a = array("a" => "foo", "b" => "bar",); print_r($a);' Interesting. Do you mean 'Valid Syntax' in that it 'works without error', or 'Valid Syntax' in that 'it was designed to work that way'?
It was designed to work that way (see the 'possible_comma' rule in zend_language_parser.y)
If the latter, then I have learned something new, and I'd like to know more about why it is designed to work that way, and how I could use it to my advantage.
Probably because 1. People often remove or comment out elements from lists and forget to remove the comma from the new last entry eg: $config = array(
        foo => bar,
 //     baz => wibble
        );
2. Perl already made the final comma optional for similar reasons. -robin

« previous php.general (#255131) next »