-
Notifications
You must be signed in to change notification settings - Fork 0
/
practice.php
120 lines (80 loc) · 1.76 KB
/
practice.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
//KPLC Staff definition
//$leo_name = "Leo";
//$leo_staff_id = 1234;
// $leo = ['name'=>'Leo', 'staff_id' => 1234];
//
// $macharia = ['name'=>'Macharia', 'staff_id' => 12345];
//
// $kevin = ['name'=>'Kevin', 'staff_id' => 231];
$kevin['name'] = "Kevin";
$names = ['Leo','Macharia','Kevin'];
$ids = [1234,12345,231];
//$combined = array($names,$ids);
foreach ($names as $key => $name) {
echo $name." ".$ids[$key]."<br>";
# code...
}
exit;
//print_r($combined);
//print_r($ids);
exit;
$staff = array($leo,$macharia,$kevin);
//showAllStaff($staff);
$no_of_staff = count($staff);
foreach ($staff as $staff) {
echo $staff['name']."<br>";
# code...
}
// for ($i=0; $i < $no_of_staff ; $i++) {
// echo $staff[$i]['name']."<br>";
// # code...
// }
exit;
$vacancies = 5 - $no_of_staff;
//echo $no_of_staff;
//conditional statement
if ($no_of_staff>5) {
echo "No vacancy";
# code...
}else{
echo "Vacancies available: ".$vacancies;
}
//echo $leo_name." ".$leo_staff_id;
//function to echo staff
function showAllStaff($staff){
//dosomething
print_r($staff);
}
//process an incoming text
/*
$sms = "Ramogi this is Kevin, play for me fundamendozzz";
$arr = explode(' ',trim($sms));
$prefix = $arr[0];
//$prefix = substr(trim($sms),0,4);
/*$findme = 'KISS';
$pos = strpos($sms, $findme);
//print_r ($prefix);
if ($pos) {
echo "Send this message to Shaffie Weru";
# code...
}else{
echo "send this message to King'angi";
}
//switch
switch (strtolower($prefix)) {
case 'inooro':
echo "Message for Inooro FM";
break;
case 'citizen':
echo "Message for Citizen FM";
break;
case 'ramogi':
echo "Message for Ramogi FM";
break;
default:
echo "Confused Person";
break;
}
*/
?>