Sunday, 16 April 2017

PHP: Short syntax for arrays

Just letting you guys know that now you can do this:

$newSyntax = [
  'key' => 'value',
  'anotherKey' => 'anotherValue'
];
Instead of this:
$oldSyntax = array(
  'key' => 'value',
  'anotherKey' => 'anotherValue'
);
All you need is PHP 5.4 or higher.

No comments:

Post a Comment