PHP INTERVIEW QUESTIONS & ANSWERS
What is the use of "echo" in php? - Answers -It is used to print a data in the webpage
How to include a file to a php page? - Answers -include a file using "include() " or
"require()" function with file path as its parameter.
What's the difference between include and require? - Answers -If the file is not found by
require(), it will cause a fatal error and halt the execution of the script. If the file is not
found by include(), a warning will be issued, but execution will continue.
Differences between GET and POST methods ? - Answers -We can send 1024 bytes
using GET method but POST method can transfer large amount of data and POST is
the secure method than GET method
How to declare an array in php? - Answers -$arr = array('apple', 'grape', 'lemon');
What is use of in_array() function in php ? - Answers -in_array used to checks if a value
exists in an array
What is use of count() function in php ? - Answers -count() is used to count all elements
in an array, or something in an object
What is the difference between Session and Cookie? - Answers -The main difference
between sessions and cookies is that sessions are stored on the server, and cookies
are stored on the user's computers in the text file format.
How to set cookies in PHP? - Answers -Setcookie("sample", "ram", time()+3600);
what types of loops exist in php? - Answers -for,while,do while and foreach
How we can retrieve the data in the result set of MySQL using PHP? - Answers -1.
mysql_fetch_row
2. mysql_fetch_array
3. mysql_fetch_object
4. mysql_fetch_assoc
What is the difference between explode() and split() functions? - Answers -Split
function splits string into array by regular expression. Explode splits a string into array
by string.
How stop the execution of a php scrip ? - Answers -exit() function is used to stop the
execution of a page
What is the use of "echo" in php? - Answers -It is used to print a data in the webpage
How to include a file to a php page? - Answers -include a file using "include() " or
"require()" function with file path as its parameter.
What's the difference between include and require? - Answers -If the file is not found by
require(), it will cause a fatal error and halt the execution of the script. If the file is not
found by include(), a warning will be issued, but execution will continue.
Differences between GET and POST methods ? - Answers -We can send 1024 bytes
using GET method but POST method can transfer large amount of data and POST is
the secure method than GET method
How to declare an array in php? - Answers -$arr = array('apple', 'grape', 'lemon');
What is use of in_array() function in php ? - Answers -in_array used to checks if a value
exists in an array
What is use of count() function in php ? - Answers -count() is used to count all elements
in an array, or something in an object
What is the difference between Session and Cookie? - Answers -The main difference
between sessions and cookies is that sessions are stored on the server, and cookies
are stored on the user's computers in the text file format.
How to set cookies in PHP? - Answers -Setcookie("sample", "ram", time()+3600);
what types of loops exist in php? - Answers -for,while,do while and foreach
How we can retrieve the data in the result set of MySQL using PHP? - Answers -1.
mysql_fetch_row
2. mysql_fetch_array
3. mysql_fetch_object
4. mysql_fetch_assoc
What is the difference between explode() and split() functions? - Answers -Split
function splits string into array by regular expression. Explode splits a string into array
by string.
How stop the execution of a php scrip ? - Answers -exit() function is used to stop the
execution of a page