1// sequential array
2$arr = array(
3 'v1', // $arr[0] == 'v1'
4 'v2', // $arr[1] == 'v2'
5 'v3' // $arr[2] == 'v3'
6);
7// or (since PHP 5.4)
8$arr = [
9 'v1', // $arr[0] == 'v1'
10 'v2', // $arr[1] == 'v2'
11 'v3' // $arr[2] == 'v3'
12];
13
14// key accessed array (map like)
15$arr = array(
16 'k1' => 'v1', // $arr['k1'] == 'v1'
17 'k2' => 'v2', // $arr['k2'] == 'v2'
18 'k3' => 'v3' // $arr['k3'] == 'v3'
19);
20// or (since PHP 5.4)
21$arr = [
22 'k1' => 'v1', // $arr['k1'] == 'v1'
23 'k2' => 'v2', // $arr['k2'] == 'v2'
24 'k3' => 'v3' // $arr['k3'] == 'v3'
25];