Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10563 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5624 invoked by uid 1010); 17 Jun 2004 08:42:34 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 5506 invoked from network); 17 Jun 2004 08:42:33 -0000 Received: from unknown (HELO is.magroup.ru) (213.33.179.242) by pb1.pair.com with SMTP; 17 Jun 2004 08:42:33 -0000 Received: from localhost.localdomain ([192.168.3.226]) by is.magroup.ru with Microsoft SMTPSVC(5.0.2195.6713); Thu, 17 Jun 2004 12:43:15 +0400 Date: Thu, 17 Jun 2004 12:43:15 +0400 To: internals@lists.php.net Message-ID: <20040617124315.2f25fe21.tony2001@phpclub.net> In-Reply-To: References: <5.1.0.14.0.20040617040132.01df4de8@mail.ionzoft.com> X-Mailer: Sylpheed version 0.9.11 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 17 Jun 2004 08:43:15.0647 (UTC) FILETIME=[219B8CF0:01C45447] Subject: Re: [PHP-DEV] Array Question From: tony2001@phpclub.net (Antony Dovgal) On Thu, 17 Jun 2004 10:33:39 +0200 (CEST) Derick Rethans wrote: > On Thu, 17 Jun 2004, Jason Garber wrote: > > > Hello, > > > > In PHP4 and PHP5 the following syntax works fine (note the last > > comma): > > > > array > > ( > > 1 => 'bob', > > 2 => 'sam', > > ); > > > > > > Is being able to have a comma at the END of an array definition a > > supported feature, or an undocumented feature that should not be > > used? > > It's an undocumented feature AFAIK. There is user note about it here: http://www.php.net/manual/en/function.array.php ----- 10-May-2003 03:53 Similarly to a comment by stlawson at sbcglobal dot net on this page: http://www.php.net/basic-syntax.instruction-separation It is usually advisable to define your arrays like this: $array = array( 'foo', 'bar', ); Note the comma after the last element - this is perfectly legal. Moreover, it's best to add that last comma so that when you add new elements to the array, you don't have to worry about adding a comma after what used to be the last element. $array = array( 'foo', 'bar', 'baz', ); ----- But yes, perhaps it should be mentioned in the doc, that the comma at the end is ok. --- WBR, Antony Dovgal aka tony2001 tony2001@phpclub.net || antony@dovgal.com