-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
53 lines (36 loc) · 1.47 KB
/
index.php
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
<?php
// The print() and echo() statements print string data
// print()
print "<h1>print() statement</h1>";
print "Apple";
print "<br/>";
// (or)
print("Apple");
print "<br/>";
// echo()
print "<h1>echo() statement</h1>";
echo "Apple";
print "<br/>";
// (or)
echo ("Apple");
print "<br/>";
// Output AppleOrangeGrapes
echo "Apple", "Orange", "Grapes";
// not a valid statement
// echo ("Apple","Orange","Grapes");
// The printf() is used to print the formatted output by using the values passed as the parameter of this function
print "<h1>printf() statement</h1>";
printf('We are expected to score above %d%% for distinction', 85);
// Output: We are expected to score above 85%
// for distinction
// The sprintf() is similar to the printf() function except that it can return the formatted string instead of printing it to the browser. Then we can store it into a variable.
// The print_r() is used to print compound datatype-like PHP arrays or objects
print "<h1>print_r() statement</h1>";
print_r($_FILES); // returns array
print_r(false); // returns empty string
// The var_dump() also prints array data in structured manner. It gives additional data, like, the data type, the length, values and more
print "<h1>var_dump() statement</h1>";
var_dump(false); // prints bool(false)
print "<br/>";
var_dump($_FILES); // prints array
?>