-
Notifications
You must be signed in to change notification settings - Fork 0
/
28.array.php
45 lines (33 loc) · 838 Bytes
/
28.array.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
<?php
$colors = array("red", 4565, "green", 4545);
echo $colors[3] . "<br>";
//
$colors = ["red", 4565, "green", 4545];
echo $colors[0] . "<br>";
echo $colors[1] . "<br>";
echo $colors[2] . "<br>";
echo $colors[3] . "<br>";
//
$colors = ["red", 4565, "green", 4545];
print_r($colors);
//
$colors = ["red", 4565, "green", 4545];
echo "<pre>";
print_r($colors);
echo "<pre>";
//
$colors[0] = "red" . "<br>";
$colors[1] = "green" . "<br>";
$colors[2] = "yellow" . "<br>";
$colors[3] = "blue" . "<br>";
echo "<pre>";
print_r($colors);
echo "<pre>";
//
$colors = ["red", 4565, "green", 4545];
echo "<ul>";
for ($i=0; $i < 4 ; $i++) {
echo "<li>" . $colors[$i] . "</li>" ."<br>";
}
echo "</ul>";
?>