Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27855 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96769 invoked by uid 1010); 6 Feb 2007 14:47:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 96754 invoked from network); 6 Feb 2007 14:47:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2007 14:47:10 -0000 Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 213.152.38.186 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 213.152.38.186 freshmint.phcomp.co.uk Linux 2.5 (sometimes 2.4) (4) Received: from [213.152.38.186] ([213.152.38.186:61432] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0C/E2-04145-DE498C54 for ; Tue, 06 Feb 2007 09:47:10 -0500 Received: from addw by mint.phcomp.co.uk with local (Exim 4.66) (envelope-from ) id 1HERav-0004Sm-Fe; Tue, 06 Feb 2007 14:46:53 +0000 Date: Tue, 6 Feb 2007 14:46:53 +0000 To: Robert Cummings Cc: "Ford, Mike" , Brian Moon , internals@lists.php.net Message-ID: <20070206144653.GW5327@mint.phcomp.co.uk> References: <1170772895.9567.4.camel@blobule> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1170772895.9567.4.camel@blobule> User-Agent: Mutt/1.4.1i Organization: Parliament Hill Computers Ltd Subject: Re: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array From: addw@phcomp.co.uk (Alain Williams) On Tue, Feb 06, 2007 at 09:41:34AM -0500, Robert Cummings wrote: > On Tue, 2007-02-06 at 14:08 +0000, Ford, Mike wrote: > > On 05 February 2007 17:29, Brian Moon wrote: > > > That is why you have coding standards. Our doucment states that this > > > should be written as: > > > > > > $a = array( > > > 1 => array('pears', 'apples'), > > > 2 => array('juice', 'oranges') > > > ); > > > > > > I believe in either syntax, proper formatting of complex data > > > can solve > > > the readablity problems. > > > > Solve, no. Alleviate, yes. > > > > Given the above, the layout tells me there's some kind of structure > > going on, but I still have to actually *read* it to discover > > that there are arrays involved (and where they start and end). > > > > With this version: > > > > $a = [ > > 1 => ['pears', 'apples'], > > 2 => ['juice', 'oranges'] > > ]; > > > > I can take one glance and tell there are nested arrays involved, and > > what their scopes are -- I'd say my comprehension speed is at least > > an order of magnitude faster! > > > > *That* makes this syntax a no-brainer for me, personally ;-) > > Ummm, you still had to read it. One "glance" just so happens to involve > the brain grokking the content, just like reading. I must agree that the [] is easier/quicker to read than array(), but is it really worth it ... too many syntaxes for the same thing ? Anyway: it makes php look like perl -- and that would never do :-) -- Alain Williams Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include