-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrays.php
More file actions
65 lines (55 loc) · 1.13 KB
/
arrays.php
File metadata and controls
65 lines (55 loc) · 1.13 KB
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
54
55
56
57
58
59
60
61
62
63
<?php
// indexed or numeric arrays / the content is arranged in a numerical order
$color = ["black" , "green","yellow"];
print_r($color);
?>
<pre>
<?php print_r ($color);?>
</pre>
<br>
<?php
$user = array ("Alex ","Peter","Ann");
?>
<pre>
<?php print_r($user);?>
</pre>
<?php
// associative arrays
$user_data = [
"fullname" => "alex okama",
"email" => "aokama@yahoo.com",
"phone" => "+254712345678"
];
print $user_data["email"];
?>
<pre>
<?php print_r ($user_data);?>
</pre>
<br>
<?php print $user_data["phone"]; ?>
<br>
<?php
$user_details =[
"Director" => array(
"fullname" => "alex okama",
"email" => "aokama@yahoo.com",
"phone" => [
"home" => "34567890",
"work" => "56789089",
"mobile" => "4567890",
]
),
"Secretary" => array(
"fullname" => "Clara okemi",
"email" => "COkemi@yahoo.com",
"phone" => [
"home" => "9876543",
"work" => "76365539",
"mobile" => "433567768",
]
),
];
?>
<pre>
<?php print_r($user_details); ?>
</pre>