# Proposal: Array syntax

- Thread: https://externals.io/message/5293
- Original archive: https://news-web.php.net/php.internals/5293
- Started by Ford on 2003-11-06T12:09:54+00:00
- Messages: 4
- 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

---

## #5293 — Ford — 2003-11-06T12:09:54+00:00

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

> Ford, Mike [LSS] wrote:
> > […]
> 
> The fact that $b[11] references an item of an array, while
> [1,2,$b[11]] assigns values to the array $a.

That's not confusing -- at least no more so than the different meanings of -
in $b = -$a and $b = $c - $a.

>  The fact that you (and,
> probably, most of us) can't tell right off the bat

Bzzt!  Wrong!  It was because I *could* tell right off the bat exactly what
it meant that I asked why it was confusing.

>  is a clear sign
> that this is a bad idea, because it's ambiguous and confusing.

And again, wrong assumption -- I asked what's confusing because to me it
looks completely unambiguous and totally clear.

> The same line using the current syntax, btw, would have looked like
> this: 
> 
> $a = array (1,3,$b[11]);

Well, I can see true enough that that has the same meaning, but for me it's
harder to read and interpret.  I see the () first and start assuming it's a
function, before my eyes and brain have time to digest that the name of the
"function" is array -- result: a moment's confusion whilst I deal with the
ambiguity of using function syntax for a language construct.  With the []
syntax, I see the square brackets and they immediately shout ARRAY
CONSTRUCTOR at me -- result: instant understanding and I'm on to the next
line of code in a flash.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211

---

## #5295 — Sascha Schumann — 2003-11-06T12:30:41+00:00

URL: https://externals.io/message/5293#5295 · In reply to: #5293

Please move this thread to private email.

    - Sascha

---

## #5296 — Andi Gutmans — 2003-11-06T13:28:39+00:00

URL: https://externals.io/message/5293#5296 · In reply to: #5293

Sascha,

I don't think it's a private matter. Feel free to delete the emails with 
this subject when they come in.

Andi

At 01:30 PM 11/6/2003 +0100, Sascha Schumann wrote:
>     Please move this thread to private email.
>
>     - Sascha

---

## #5297 — Sascha Schumann — 2003-11-06T13:46:41+00:00

URL: https://externals.io/message/5293#5297 · In reply to: #5296

> Sascha,
>
> I don't think it's a private matter.

    If there was anything constructive in that long thread of "I
    like it" -- "no, I don't!" I might agree with you, but given
    the current contents, the noise exceeds the useful debate by
    far.

    - Sascha
