forked from btcmp/bootcamp186
-
Notifications
You must be signed in to change notification settings - Fork 0
/
myarray.php
53 lines (41 loc) · 813 Bytes
/
myarray.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
//Array
$name = "arrizaqu";
$age = 17;
//setting index
$data = array();
$data[0] = $name;
$data[1] = $age;
$data[2] = new DateTime();
$data[3] = array();
//automatically
$data2 = array(
0 => 'jakarta',
1 => 'surabaya',
2 => 'bandung'
);
$countries = array(
'Indonesia' => array(
0 => 'jakarta',
1 => 'bandung'
),
'Amerika' => array(
0 => 'New york',
1 => 'LA'
)
);
$values = array(1,2,3,4,5);
$cities = array('jakarta', 'bandung');
//array untuk struktur data
$employee = array(
'nama' => null,
'alamat' => null,
'email' => null
);
$employee['nama'] = 'arrizaqu';
$employee['alamat'] = 'seputih banyak';
$employee['email'] = '[email protected]';
//object -> {}, array -> []
echo "<pre>";
var_dump($employee);
echo "</pre>";