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 <std_disclaimer.h>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to