Created
July 23, 2011 22:25
-
-
Save Javlopez/1101954 to your computer and use it in GitHub Desktop.
PHP5.4 Short syntax for arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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