PHP Short Syntax for Arrays: developers say no.
wiki.php.net
PHP Short Syntax for Arrays: developers say no.
1–10 of 89 posts
Re: PHP Short Syntax for Arrays: developers say no.
#2Kinda strange that they have both readable and unreadable listed as both pro and con...
Re: PHP Short Syntax for Arrays: developers say no.
#3-edit- beaten to the punch on that one!
Re: PHP Short Syntax for Arrays: developers say no.
#4 Contra
...
Not searchable through search engines
That's a ridiculous argument.Re: PHP Short Syntax for Arrays: developers say no.
#5I've been wanting this for a long time, seems like a no brainer to me. It'd be nice to add some of the nice syntactic sugar that other languages have. Kinda strange that they have both readable and unreadable listed as both pro and con...
I found array_map, array_filter, array_key_exists, array_this, array_that painful to write, but never felt that I was gaining any sort of readability for it.
Re: PHP Short Syntax for Arrays: developers say no.
#6I've been wanting this for a long time, seems like a no brainer to me. It'd be nice to add some of the nice syntactic sugar that other languages have. Kinda strange that they have both readable and unreadable listed as both pro and con...
I think it would have been a nice addition...
Re: PHP Short Syntax for Arrays: developers say no.
#7 $a1 = [1, 2, 3];
$b1 = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];
$b2 = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];
$a1 = array(1, 2, 3);
$b1 = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');
It would be a nice change to have, but the syntax isn't -that- much better. A compromise might be: $b1 = array('foo': 'orange', 'bar': 'apple', 'baz': 'lemon');
But even then, you only save two characters per key:value.Re: PHP Short Syntax for Arrays: developers say no.
#8Re: PHP Short Syntax for Arrays: developers say no.
#9I've been wanting this for a long time, seems like a no brainer to me. It'd be nice to add some of the nice syntactic sugar that other languages have. Kinda strange that they have both readable and unreadable listed as both pro and con...