$array = array(
"foo" => "bar",
"bar" => "foo",
);
$array = array(
"foo" => "bar",
"bar" => "foo",
);
<?php
$fruits = array("mango","orange","apple");
?>
<?php
$array = array(
"foo" => "bar",
"bar" => "foo",
);
// Utilisant la syntaxe de tableau courte
$array = [
"foo" => "bar",
"bar" => "foo",
];
?>
// sequential array
$arr = array(
'v1', // $arr[0] == 'v1'
'v2', // $arr[1] == 'v2'
'v3' // $arr[2] == 'v3'
);
// or (since PHP 5.4)
$arr = [
'v1', // $arr[0] == 'v1'
'v2', // $arr[1] == 'v2'
'v3' // $arr[2] == 'v3'
];
// key accessed array (map like)
$arr = array(
'k1' => 'v1', // $arr['k1'] == 'v1'
'k2' => 'v2', // $arr['k2'] == 'v2'
'k3' => 'v3' // $arr['k3'] == 'v3'
);
// or (since PHP 5.4)
$arr = [
'k1' => 'v1', // $arr['k1'] == 'v1'
'k2' => 'v2', // $arr['k2'] == 'v2'
'k3' => 'v3' // $arr['k3'] == 'v3'
];
<?php
$a = array("c", "a", "t");
$b = ["b", "a", "t"];
$c[0] = "r";
$c[1] = "a";
$c[2] = "t";
?>