forked from assembler-institute/php-basics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
52 lines (39 loc) · 913 Bytes
/
functions.php
File metadata and controls
52 lines (39 loc) · 913 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>functions.php</title>
</head>
<body>
<h1>Functions</h1>
<?php
function sum($num1, $num2) {
echo $num1 + $num2;
}
sum(5, 2);
echo ("<br/>");
function mult($num1, $num2) {
echo $num1 * $num2;
}
mult(7, 5);
echo ("<br/>");
function divs($num1, $num2) {
echo $num1 / $num2;
}
divs(10, 5);
echo ("<br/>");
function operation($n1, $n2, $ops) {
if ($ops == "+") {
return $n1 + $n2;
}elseif ($ops == "*") {
return $n1 * $n2;
}else if ($ops == "/") {
return $n1 / $n2;
}
}
echo operation(2, 3, "*");
?>
</body>
</html>