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
46 lines (31 loc) · 767 Bytes
/
functions.php
File metadata and controls
46 lines (31 loc) · 767 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
<?php
#SUM TWO NUMBERS
function addTwoNumbers(int $x, int $y){
return $x + $y;
}
echo "The sum of 10 and 25 is: " .addTwoNumbers(10, 25);
echo "<br>";
# MULTIPLY TWO NUMBER
function multiplynumbers($x, $y){
return $x * $y;
}
echo "The result of multiply number 2 and 3 is: " .multiplynumbers(2, 3);
echo "<br>";
# DIVISION TWO NUMBER
function divisionTwoNumbers($x, $y){
return $x / $y;
}
echo "The result of the division of 10 and 2 is: ". divisionTwoNumbers(10,2);
echo "<br>";
function TwoNumbers($x, $y, $operator){
if($operator == "add"){
return $x + $y;
} else if($operator == "multiply"){
return $x * $y;
}
}
echo TwoNumbers(2, 5, "add");
echo "<br>";
echo TwoNumbers(2, 5, "multiply");
echo "<br>";
?>