Re: Re: Short syntax for array literals [...]

From: Date: Wed, 28 May 2008 07:33:09 +0000
Subject: Re: Re: Short syntax for array literals [...]
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-37948@lists.php.net to get a copy of this message
On 28.05.2008 11:24, Alexey Zakhlestin wrote:
know PHP, but have a certain experience with *script languages, i.e. you're going to do a favor for 1% and confuse the remaining 99%.
percentage is way different. such "short array syntax" is a common ground for a lot of modern dynamic languages.
People who do not know PHP and come from *script languages are surely NOT the majority and I daresay their number is infinitely smaller than the number of people who know array() syntax by heart.
And at last, but not least I don't see anything "more readable and maintainable" in using square brackets to initialize arrays when the same brackets are used to access them: $a = [$a[1][2], 3]; /* wth does this mean? */
initialize variable $a as array, with elements: 0) value-of-key "2" of array located at key "1" of old array $a 1) 3 difficult to "spell", but easy to understand
Will you spell it for me each time I stumble upon such a "readable" construct, pretty please? -- Wbr, Antony Dovgal

« previous php.internals (#37948) next »