Skip to content

Instantly share code, notes, and snippets.

@alancoleman
Last active December 17, 2015 12:39
Show Gist options
  • Save alancoleman/5611562 to your computer and use it in GitHub Desktop.
Save alancoleman/5611562 to your computer and use it in GitHub Desktop.
Indexed array without key
<?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"
}
*/
?>
@alancoleman
Copy link
Author

// as of PHP 5.4
$array = [
"foo" => "bar",
"bar" => "foo",
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment