# Syntactic improvement to array

- Thread: https://externals.io/message/27805
- Original archive: https://news-web.php.net/php.internals/27805
- Started by Ford on 2007-02-05T12:35:32+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #27805 — Ford — 2007-02-05T12:35:32+00:00

URL: https://externals.io/message/27805#27805

> At 23:27 04-02-07, Pierre wrote:
> > […]
> 
> One of the key guidelines of the language definition process of PHP
> was that we don't want multiple ways of doing the same thing, and we
> don't buy the argument of 'why do you care?  you can still do it the
> other way'.  Only if the new way is significantly better than the old
> way of doing things (i.e. much faster / much simpler, etc.) we
> consider it.  I think it's been a very good guideline and helped us a
> lot in keeping PHP relatively clean for a very long time.

I hadn't come across this as a stated PHP principle, and I actually
don't buy it either in respect of PHP[*] or in general.  It's often the
case, as is becoming clear with this, that different people have widely
divergent views about what is clear and easy to use/read and what isn't,
and providing alternatives that suit both camps is to me a very positive
move -- you'd end up pleasing far more people far more of the time than
by sticking rigidly to the original option.

[*] I enter into evidence here the alternative ":" block structure,
which dates back further than I care to delve (but am extremely glad
of); many function (or language construct) aliases, such as print/echo,
exit/die; foreach in place of `reset()`/each(); 3 different ways (soon to
be 4) to write a string literal; and even the inclusion of string
slicing using (ironically) a [:] syntax on the PHP 6 feature list.

> The new array syntax is arguably clearer (although some here
> disagree).  It's not MUCH clearer to the sense that it's a no
> brainer, which makes things more complicated.

In your opinion.  Personally, I find the [] syntax so much clearer that
I would rate it a no-brainer to include it.  But, by the same token,
there are also people on here who would rate it a no-brainer *not* to
include it.

Finally, I really don't see the argument that the [] syntax is non-
obvious. If you're working with arrays at all, you have to know that
[] is used to subscript out individual elements, so it seems to me
abundantly clear that other uses of [] are most likely to be array-
related and a quick step to the Arrays section of the manual would be
in order.

OK, as a mere enthusiastic user I've probably said more than I am
entitled to, so I'll disappear for now...!!

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 


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
