php array element code example
Example 1: php array
<?php
$array = array(
"foo" => "bar",
42 => 24,
"multi" => array(
"dimensional" => array(
"array" => "foo"
)
)
);
var_dump($array["foo"]);
var_dump($array[42]);
var_dump($array["multi"]["dimensional"]["array"]);
?>
Example 2: php arrays
$nums = [1, 2, 3, 4, 5];
Example 3: php array
$array = ['cheese', 'ham', 'potato'];
var_dump($array);
Example 4: php define variables from array associative
<?php
$array = [
'key1' => 'foo',
'key2' => 'bar',
];
extract($array);
echo $key1;
echo $key2;
?>