Skip to content

Commit 1e96e52

Browse files
Add files via upload
1 parent cebe4e7 commit 1e96e52

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Functions/Functions.php

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Functions in PHP</title>
7+
</head>
8+
<body>
9+
10+
<?php
11+
12+
# Functions are a way of grouping a series of statements that perform a specific task
13+
# Functions make the code reusable
14+
15+
echo "<p>Using Functions in PHP</p>";
16+
17+
# Functions with No Argument
18+
echo "<p>Functions with No Argument</p>";
19+
20+
function greet(){
21+
echo "<p>Hello, How are You?</p>";
22+
}
23+
# Calling the function
24+
greet();
25+
26+
# Functions with One Argument
27+
echo "<p>Functions with One Argument</p>";
28+
29+
function greetUser($n){
30+
echo "<p>Hello $n</p>";
31+
}
32+
# Calling the function
33+
greetUser("Jack");
34+
35+
# Functions with Three Argument and return value
36+
echo "<p>Functions with Three Argument and Return Value</p>";
37+
38+
function calc($n1,$n2,$n3){
39+
return $n1+$n2+$n3;
40+
}
41+
# Calling the function
42+
echo "<p>Result of Addition is: ",calc(12,56,78),"</p>";
43+
44+
?>
45+
46+
</body>
47+
</html>

0 commit comments

Comments
 (0)