PHP Programming
Question Bank
a) What these tags specify in PHP : <?php and ?>
b) Can we run PHP from HTML file? If yes, how?
c) Why PHP is known as scripting language?
d) Write a program in PHP to calculate Square Root of a number?
e) How can we create links in PHP pages?
f) What is the function of “foreach” construct in PHP?
g) What is the purpose of “nl2br “string function?
h) Write the name of PHP functions that can be used to build a function that accepts any number of
arguments?
i) What is the difference between include and require?
j) Differences between GET and POST methods?
k) What do you mean by Server Side Scripting?
l) Explain all possible types of scope of variable?
m) Explain with example the use of substring function?
n) Write a program in HTML (Web-Page) having a form with firstname, lastname and a submit button.
On clicking the button form validation should work (Use Javascript for that) and data entry should be
saved in a database (PHP code needed, for insertion of data from “form” to database). Form should be
styled using CSS. (Use any mode- inline, internal or external)?
o) What do you understand about Numeric array, Associative array and Multidimensional array?
p) What is the use of strlen() and strpos() functions?
q) Why we use $_REQUEST variable? Write a note on various library functions available in PHP?
r) What is the function name in PHP, used to delete an element from an array?
s) Write the PHP code for fetching the data from a database to a webpage?
t) What is the purpose of $_PHP_SELF?
u) Explain the use of preg_match(), preg_replace(), preg_split(),ereg() , eregi() ,ereg_replace(),
ereg_match() ,eregi_replace() functions in regular expression?
v) What do you meant by WAMP, LAMP and XAMP?
w) Explain the following:
1) Echo vs Print
2) Super variable
3) Super global operator
4) Literals
5) Ternary operator
6) Break and continue
x) Write about the following built-in functions:
1) Require() 10) Join()
2) Auto_append_file() 11) substr()
3) Include() 12) Strcmp()
4) Chop() 13) Strnotcmp()
5) Trim() 14) strlen()
6) nl2br() 15) strchar()
7) strtoupper() 16) stropos()
8) strtolower() 17) strreplace()
9) explode() 18)substr_replace()