Skip to content

Instantly share code, notes, and snippets.

@Javlopez
Created July 23, 2011 22:25
Show Gist options
  • Save Javlopez/1101954 to your computer and use it in GitHub Desktop.
Save Javlopez/1101954 to your computer and use it in GitHub Desktop.
PHP5.4 Short syntax for arrays
<?php
// Square bracket array shortcut - keys and values are separated by colons:
$a = [1, 2, 3];
$b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];
//Square bracket array shortcut - keys and values are separated by double arrows:
$a = [1, 2, 3];
$b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment