-
Notifications
You must be signed in to change notification settings - Fork 0
/
tryme.php
58 lines (44 loc) · 911 Bytes
/
tryme.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
<?php
//Practice 2: Function Decleration
function welcome($name, $age)
{
print 'welcome to the site' . $name . '. You are'. $age. 'years old';
}
echo welcome(' Chris', '18');
print "\n";
//Practice 2: Function Decleration
function add ($num1, $num2)
{
print(+$num1+$num2);
print"\n";
}
echo add(2, 3);
//Practice 3
function substract ($num1, $num2)
{
$total = $num1-$num2;
return $total;
}
print substract(5,3);
//Practicing If Statements
$name = 'Top';
if($name =='Chris')
{
echo ('Hello Chris');
}
elseif ($name = 'Tom')
{
echo 'Welcome Tom';
}
else
{
echo'You are not Chris';
}
?>
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>