4 ms·
If creating a new language that looked like PHP/C/Java/etc, you could use {} for both blocks and arrays (and assoc arrays, like PHP) by making blocks a special
by randallsquared 18y ago
If creating a new language that looked like PHP/C/Java/etc, you could use {} for both blocks and arrays (and assoc arrays, like PHP) by making blocks a special case of arrays, conceptually. Then {0; 1; 2; 3;} would be an array of four elements, and as a bonus it would free up [] for something else. :)
- mojuba 18y agoLike in C or Perl, OK, but that makes both unreadable for humans rather than for compilers, that's what I'm saying. So the reasons behind PHP's array() construct are not trivial.