PHP 5.4 Introduces Short Arrays

Comments

The more time I spend coding in Javascript, the more PHP feels old and clumsy.

Many developers feel that way, and that’s probably why they introduced a small, JS-like improvement in PHP 5.4 - short arrays:

1
2
$a = [1, 2, 3, 4];
$a = ['one' => 1, 2, 'three' => 3, 4];

Comments