-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path12.functions.php
More file actions
39 lines (34 loc) · 807 Bytes
/
12.functions.php
File metadata and controls
39 lines (34 loc) · 807 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
<?php
// Functions
// Function Declaration
function greet(){
echo "Hello World!"; // Function Body
}
// Function Call
greet();
echo "<br>";
// Function with Parameters
function greet2($name){
echo "Hello $name!";
}
greet2("Supriyo");
echo "<br>";
// Function with Default Parameters
function greet3($name = "User"){
echo "Hello $name!";
}
greet3();
echo "<br>";
// Function with Return Value
function greet4($name = "User"){
return "Hello $name!";
}
echo greet4("Rupa");
echo "<br>";
// Function with Multiple Return Value
function greet5($name = "User"){
return ["Hello $name!", "Welcome to PHP!"];
}
$result = greet5("Rupa");
echo "$result[0] <br>";
?>