php array get code example
Example 1: array php
<?php
$array = array(
"foo" => "bar",
"bar" => "foo",
);
// as of PHP 5.4
$array = [
"foo" => "bar",
"bar" => "foo",
];
?>
Example 2: php array
<?php
$array = array("foo", "bar", "hello", "world");
var_dump($array);
?>
Example 3: php array
$array = ['cheese', 'ham', 'potato'];
var_dump($array);
Example 4: tab php
$tab = array(); // empty tab
$tab = array("0" => "Hello", "1" => "world"); // $tab[0]="hello" and $tab[1]="world"