# Proposal: Array syntax

- Thread: https://externals.io/message/5237
- Original archive: https://news-web.php.net/php.internals/5237
- Started by Ford on 2003-11-05T17:01:21+00:00
- Messages: 3
- 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

---

## #5237 — Ford — 2003-11-05T17:01:21+00:00

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

On 05 November 2003 16:48, Ilia Alshanetsky contributed these pearls of
wisdom:

> I mean c'mon, is 5 characters that much of a problem and is
> absolute code clarity not worth those 5 characters? Character
> efficiency is done in Perl, where you can do things like ~=
> and @_, but that makes Perl code naturally obfuscated and I do
> not think that's a good way to go. 

I don't think the number of characters is the main issue here -- it's about
having a *nicer* set of characters.  Personally, I'd be still be in favour
(although not quite as much) if the proposed syntax were [[[1,2,3]]] -- for
me, it's about having a syntax that shouts *ARRAY* rather than whispers it.
(Although the reduction in characters is handy -- particularly in a
construct like ['foo' => ['bar'=>'on', 'baz'=>[2,3,5,7]],
'bedrock'=>['rubble'=>['barney', 'betty'], 'flintstone'=>['fred',
'wilma']]].)

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@leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211

---

## #5241 — Ilia Alshanetsky — 2003-11-05T17:25:57+00:00

URL: https://externals.io/message/5237#5241 · In reply to: #5237

> I don't think the number of characters is the main issue here -- it's about
> having a *nicer* set of characters.  Personally, I'd be still be in favour
> (although not quite as much) if the proposed syntax were [[[1,2,3]]] -- for
> me, it's about having a syntax that shouts *ARRAY* rather than whispers it.
> (Although the reduction in characters is handy -- particularly in a
> construct like ['foo' => ['bar'=>'on', 'baz'=>[2,3,5,7]],
> 'bedrock'=>['rubble'=>['barney', 'betty'], 'flintstone'=>['fred',
> 'wilma']]].)

Sure, now support one of your string array keys/values contains a [ or ] 
character. That would wreak havoc with the readability of the code.

Having 2 separate syntaxes would mean that some devs would use one format and 
the other another. And eventually you'll end up with the same code written in 
2 separate ways within the same script/application because 1 part (older?) 
was written in 1 way and the other (newer) written in another. This makes the 
entire application more difficult to understand and since many people learn 
through modifying scripts you'll create more barriers to entry for new users.

A few more examples how this will cause problems:

$a[1,2,3,4][] = [5,6,7,8][2];

Ilia

---

## #5263 — Andrei Zmievski — 2003-11-05T18:39:29+00:00

URL: https://externals.io/message/5237#5263 · In reply to: #5237

> On 05 November 2003 16:48, Ilia Alshanetsky contributed these pearls of
> wisdom:
> 
> > […]
> 
> I don't think the number of characters is the main issue here -- it's about
> having a *nicer* set of characters.  Personally, I'd be still be in favour
> (although not quite as much) if the proposed syntax were [[[1,2,3]]] -- for
> me, it's about having a syntax that shouts *ARRAY* rather than whispers it.

And array() steps too softly for you?

- Andrei
