forked from pav29517/php3Vt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pole.php
83 lines (53 loc) · 1.15 KB
/
pole.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
include 'hlavicka.php';
function opakuj($retezec,$n) {
$vysledek = '';
while ($n-- > 0) {
$vysledek = $vysledek . $retezec;
}
return $vysledek;
}
echo opakuj('L',50);
echo "<h1>Array</h1>";
$pole[] = 'Bart';
$pole[] = 'pepa';
$pole[] = 77;
$pole[] = 'tonda';
$pole[] = 'honza';
$pole[] = 'Jeronym';
$pole[] = 'Adéla';
$zelenina = array('zeli', 'mrkev', 'paprika');
echo sizeof($pole);
for ($i=0; $i<sizeof($pole); $i++) {
echo "<li> $pole[$i] </li>";
}
echo $zelenina[1];
$hash['sobota'] = 6;
$hash['nedele'] = 7;
$hash['pondeli'] = 1;
$hash['utery'] = 2;
$hash['3'] = 'streda';
$klic='hugo';
$hash[$klic] = 'Okurka';
echo "<pre>";
print_r($hash);
print_r(array_keys($hash));
echo "</pre>";
echo $prochozani = <<<EOF
<h1>Procházení pole</h1>
<ul>
EOF;
foreach ($pole as $key => $value) {
echo "<li>$key: $value</li>";
}
echo "<li>-------------------------</li>";
foreach ($hash as $key => $value) {
echo "<li>$key: $value</li>";
}
echo "<li>-------------------------</li>";
foreach (array_keys($hash) as $key ) {
echo "<li>$key: $hash[$key]</li>";
}
echo "</ul>";
include 'paticka.php';
?>