Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27851 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81495 invoked by uid 1010); 6 Feb 2007 14:13:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 81480 invoked from network); 6 Feb 2007 14:13:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2007 14:13:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=M.Ford@leedsmet.ac.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=M.Ford@leedsmet.ac.uk; sender-id=pass Received-SPF: pass (pb1.pair.com: domain leedsmet.ac.uk designates 160.9.128.16 as permitted sender) X-PHP-List-Original-Sender: M.Ford@leedsmet.ac.uk X-Host-Fingerprint: 160.9.128.16 mrelay-a.lmu.ac.uk Linux 2.4/2.6 Received: from [160.9.128.16] ([160.9.128.16:25781] helo=mrelay-a.lmu.ac.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/21-04145-B1D88C54 for ; Tue, 06 Feb 2007 09:13:48 -0500 Received: from localhost.lmu.ac.uk ([127.0.0.1] helo=localhost) by mrelay-a.lmu.ac.uk with esmtp (Exim 4.43) id 1HER2S-0006WL-Mu; Tue, 06 Feb 2007 14:11:16 +0000 Received: from mrelay-a.lmu.ac.uk ([127.0.0.1]) by localhost (mrelay-a [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24275-03; Tue, 6 Feb 2007 14:11:13 +0000 (GMT) Received: from leedsmet-exch1.leedsmet.ac.uk ([160.9.35.117]) by mrelay-a.lmu.ac.uk with esmtp (Exim 4.43) id 1HEQyW-0006MN-Vp; Tue, 06 Feb 2007 14:07:13 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Tue, 6 Feb 2007 14:08:13 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array thread-index: AcdJS+9nCyhnEM+6SM+4Z7+5uYOTagAqpvbg To: "Brian Moon" Cc: X-Virus-Scanned: by McAfee at Leeds Metropolitan University Subject: RE: [PHP-DEV] [SPAM] Re: [PHP-DEV] Syntactic improvement to array From: M.Ford@leedsmet.ac.uk ("Ford, Mike") On 05 February 2007 17:29, Brian Moon wrote: > Ford, Mike wrote: > > > I don't find: > > >=20 > > > $a =3D [1 =3D> ['pears', 'apples'], 2 =3D> ['juice', 'oranges']]; > > >=20 > > > any less readable than: > > >=20 > > > $a =3D array(1 =3D> array('pears', 'apples'), 2 =3D> array('juice', > > > 'oranges'));=20 > > >=20 > > > Quite the opposite actually :) > >=20 > > Me too - I go beyond Edin on this one, as I find the > array() version actually quite UNreadable and I have > difficulty picking out what the individual arrays are; > conversely, the [] version I take in at a glance. >=20 > That is why you have coding standards. Our doucment states that this > should be written as:=20 >=20 > $a =3D array( > 1 =3D> array('pears', 'apples'), > 2 =3D> array('juice', 'oranges') > ); >=20 > 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 =3D [ 1 =3D> ['pears', 'apples'], 2 =3D> ['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 ;-) Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211=20 To view the terms under which this email is distributed, please go to http:= //disclaimer.leedsmet.ac.uk/email.htm