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
38 lines (26 loc) · 661 Bytes
/
Copy pathfunctions.php
File metadata and controls
38 lines (26 loc) · 661 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
<?php
function sum($num1, $num2){
return $num1 + $num2;
}
print_r("The sum is: " . sum(5, 5) . "\n");
function mult($num1, $num2){
return $num1 * $num2;
}
print_r("The multiplication is: " . mult(5, 5) . "\n");
function div($num1, $num2){
return $num1 / $num2;
}
print_r("The division is: " . div(5, 5) . "\n");
function operation($operator, $num1, $num2){
if($operator == "+"){
return sum($num1, $num2);
}
if($operator == "/"){
return div($num1, $num2);
}
if($operator == "*"){
return mult($num1, $num2);
}
}
print_r("The operation is: " . operation("*", 5, 5) . "\n");
?>