-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunctions.php
More file actions
63 lines (47 loc) · 1.21 KB
/
functions.php
File metadata and controls
63 lines (47 loc) · 1.21 KB
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
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* Topic: Functions
* Author: Muhammad Afzal
* Class: e-Rozgaar Batch#11
* Date: 8th Jan 2021
*/
//Define Constants
define("BR","<br />");
//Simple Function
function Greetings(){
echo "Welcome to e-Rozgaar Batch#11".BR;
}
//Calling the Simple Function
Greetings();
//Function with Params
function GreetingsP($name){
echo "Welcome ".$name." To e-Rozgaar Batch#11".BR;
}
GreetingsP("Afzal");
//Function With Multiple Params
function Power($value1,$value2){
echo $value1**$value2.BR;
}
Power(3,3);
//Function With Multiple Params and Return Value
function PowerR($value1,$value2){
return $value1**$value2;
}
//Mod Function
function Mod($value1,$value2){
return $value1%$value2;
}
//Equation 5^117mod19
$result=Mod(PowerR(5,117),19);
echo "Result of Equation 5^117mod19=".$result.BR;
//Function with Pass By Ref Params
function PassByRef(&$value){
++$value;
}
$counter=1;
PassByRef($counter);
echo $counter.BR;
$counter=7;
PassByRef($counter);
echo $counter.BR;
?>