Last active
December 17, 2015 12:39
-
-
Save alancoleman/5611562 to your computer and use it in GitHub Desktop.
Indexed array without key
This file contains hidden or 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 | |
//Indexed arrays without key | |
$array = array("foo", "bar", "hallo", "world"); | |
var_dump($array); | |
/* | |
Will output the following: | |
array(4) { | |
[0]=> | |
string(3) "foo" | |
[1]=> | |
string(3) "bar" | |
[2]=> | |
string(5) "hallo" | |
[3]=> | |
string(5) "world" | |
} | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// as of PHP 5.4
$array = [
"foo" => "bar",
"bar" => "foo",
];