-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlecture.php
More file actions
37 lines (32 loc) · 803 Bytes
/
lecture.php
File metadata and controls
37 lines (32 loc) · 803 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
<?php
//for-each lecture
$names = [
'lvillanueva'=>"Lorena",
'mel' =>"Melissa",
'niknik' =>"Nikki",
'eddy' =>"Edrick",
'markymark' =>"Marcus",
'pancho' =>"Pancho"
];
// for ($i=0; $i < count($names); $i++) {
// $studentName = $names[$i];
// echo "Hey everybody say hello to $studentName\n";
// echo "hi $studentName\n";
// echo "hi Dr.nick!\n";
// }
//this is for each is the same as the for loop with keys
foreach ($names as $userName => $studentName) {
echo "Hey everybody, $studentName's username is $userName \n";
// echo "hi $studentName\n";
// echo "hi Dr.nick!\n";
}
// $a = 0;
// do {
// $a++;
// echo $a . PHP_EOL;
// } WHILE ($a < 3);
// $b= 0;
// while ($b<3) {
// $b++;
// echo $b . PHP_EOL;
// }