-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrays.php
More file actions
39 lines (33 loc) · 784 Bytes
/
arrays.php
File metadata and controls
39 lines (33 loc) · 784 Bytes
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
<?php
#ARRAY - variable that holds multiple value
/*
- Indexed
- Associative
- Multi-dimensional
*/
// Indexed
$people = array('gauresh', 'pritesh', 'amar');
// echo $people[1];
$ids = array(12, 15, 18);
// echo "<br>" . $ids[2];
// echo "<br>" . count($ids);
// echo "<br>";
// print_r($ids);
// var_dump($people);
// Associative array
$people = array(
'gauresh' => 21,
'pritesh' => 20,
'amar' => 45
);
// echo $people['gauresh'];
$people['padma'] = 38;
// echo $people['padma'];
// Multi-dimensional Array
$cars = array(
array('honda', 20, 10),
array('ford', 30, 15),
array('toyota', 30, 10),
);
echo $cars[1][0];
?>