-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.php
More file actions
87 lines (61 loc) · 1.9 KB
/
function.php
File metadata and controls
87 lines (61 loc) · 1.9 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
//==============function===================:
function hello(){
return "My name is Pobitro Raj";
}
echo hello();
function title(){
return "This is Title";
}
$our_title = title();
function desc(){
return "this is description";
}
?>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title><?php echo $our_title; ?></title>
</head>
<body>
<h2><?php echo desc(); ?></h2><hr>
</body>
</html>
<?php
//============some built in function==============:
$date = date('d M, Y');
date_default_timezone_set("Asia/Dhaka");
$time = date("h:i:sa");
echo "The Current time is ".$time;
// echo phpinfo();
// Built in function:
$test1 = "Welcome to Bangladesh"."<hr>";
$test2 = "Hello Bangladesh";
$test_array = array('one', 'two', 'three');
echo "<hr>";
echo strlen($test2).'<br>';
echo gettype($test2).'<br>';
print_r($test_array).'<br>';
var_dump($test_array).'<br><hr>';
echo "<hr>";
echo strtoupper($test1);
echo strtolower($test1);
echo str_replace('Bangladesh' , 'Australia' , $test1); //echo str_replace('search' , 'replace' , 'subject');
//function:( parameter::argument)
function person($any ="a", $pro = "web Programmer"){
// return "Pobitro is $any $pro"; //for double ("")
return 'pobitro is'.' '.$any.' '.$pro; //for single ('')
}
function test($name='Pobitro',$location='Bangladesh'){
echo "My Name is $name"; //for single contention: 'My name is '.$name;
echo "<br>";
echo "I'm from $location"; // 'I\'m from '.$location;
}
?>
<h3><?php echo person('a', 'doctor'); ?></h3>
<h3><?php echo person('an', 'engineer'); ?></h3>
<h3><?php echo person(); ?></h3>
<h2><?php test('Raj', 'India'); ?></h2>
</body>
</html>