There is a heated debate on PHP internals list -- this in itself is not news, the list should be called "php heated debate list" btw. -- about short array syntax. What I will write here is probably know to the Drupal readers -- less known to the PHP internals list, I guess. So, I am the form API maintainer of Drupal, which probably is the most complex array based API in existence. I support the $b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];
wholeheartedly. I less like $b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];
but I guess we could be friends with this one too :) Also, could we get named parameters and closures? Please?
Commenting on this Story is closed.
My immediate reaction upon seeing this is that the double arrow syntax is more traditionally like PHP and Ruby, while the colon syntax is more like Python and JavaScript.
PHP: $b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon') # Makes an associated array
Ruby: b = {'foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'} # Makes a hash
Python: b = {'foo': 'orange', 'bar': 'apple', 'baz': 'lemon'} # Makes a dictionary
JavaScript: var b = {'foo': 'orange', 'bar': 'apple', 'baz': 'lemon'}; // Makes an object
Funny how the four languages all have different names for this.