Re: Proposal: Array syntax
| From: | Marco Tabini | Date: | Wed, 05 Nov 2003 17:18:31 +0000 |
| Subject: | Re: Proposal: Array syntax | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-5240@lists.php.net to get a copy of this message | ||
Ford, Mike [LSS] wrote:
On 05 November 2003 17:06, Marco Tabini contributed these pearls of wisdom:The fact that $b[11] references an item of an array, while [1,2,$b[11]] assigns values to the array $a. The fact that you (and, probably, most of us) can't tell right off the bat is a clear sign that this is a bad idea, because it's ambiguous and confusing. The same line using the current syntax, btw, would have looked like this: $a = array (1,3,$b[11]); As you can see the ambiguity is gone--square brackets are used for one purpose and nothing else. Cheers, MarcoChristian Schneider wrote:What's confusing about it?Marco Tabini wrote:Besides my previous points, something even more abominable: $a = [1,2,$b[11]]; Is that confusing enough for you? ;-)$a = [[1,2,3],[1=>[1,3,2,2], "a"=>[[1,2,3,4],4,[1,2]]];$a = array(array(1,2,3),array(1=>array(1,3,2,2), "a"=>array(array(1,2,3,4),4,array(1,2)));