Saturday 25 February 2012

PHP Interview Questions and Answers for Freshers and Experienced


1. Who is the father of PHP ?
2. What is the difference between $name and $$name?
3. How can we submit a form without a submit button?
4. In how many ways we can retrieve the data in the result set of MySQL using PHP?
5. What is the difference between mysql_fetch_object and mysql_fetch_array?
6. What are the differences between Get and post methods.
7. How can we extract string "pcds.co.in " from a string "http://info@pcds.co.in using regular expression of PHP?
8. How can we create a database using PHP and MySQL?
9. What are the differences between require and include? 
10. Can we use include ("xyz.PHP") two times in a PHP page "index.PHP"?
11.  What are the different tables(Engine) present in MySQL, which one is default?  
12. What is use of header() function in php ?
13. How can I execute a PHP script using command line?
14. Suppose your Zend engine supports the mode <? ?> Then how can u
15. Shopping cart online validation i.e. how can we configure Paypal, etc.?
16. What is meant by nl2br()?
17. What is htaccess? Why do we use this and Where?
18. How we get IP address of client, previous reference page etc ?
19. What are the reasons for selecting lamp (Linux, apache, MySQL, PHP) instead of combination of other software programs, servers and operating systems?
20. How can we encrypt and decrypt a data present in a MySQL table using MySQL?
21. How can we encrypt the username and password using PHP?
22. What are the features and advantages of object-oriented programming?
23. What are the differences between procedure-oriented languages and object-oriented languages?
24. What is the use of friend function?
25. What are the differences between public, private, protected, static, transient, final and volatile?
26. What are the different types of errors in PHP?
27. What is the functionality of the function strstr and stristr?
28. What are the differences between PHP 3 and PHP 4 and PHP 5?
29. What does is NaN function do?
30. What is the functionality of the function htmlentities?
31. How can we get second of the current time using date function?
32. How can we convert the time zones using PHP?
33. What is meant by urlencode and urldocode?
34. What is the difference between the functions unlink and unset?
35. How can we register the variables into a session?
36. How can we get the properties (size, type, width, height) of an image using PHP image functions?
37. How can we get the browser properties using PHP?
38. What is the maximum size of a file that can be uploaded using PHP and how can we change this?
39. How can we increase the execution time of a PHP script?
40. How can we take a backup of a MySQL table and how can we restore it. ?
41. How can we optimize or increase the speed of a MySQL select query?
42. How many ways can we get the value of current session id?
43. How can we destroy the session, how can we unset the variable of a session?
44. How can we set and destroy the cookie n php?
45. How many ways we can pass the variable through the navigation between the pages?
46. What is the difference between ereg_replace() and eregi_replace()?
47. What are the different functions in sorting an array?
48. How can we know the count/number of elements of an array?
49. what is session_set_save_handler in PHP?
50. How can I know that a variable is a number or not using a JavaScript?
51. List out some tools through which we can draw E-R diagrams for mysql.
52. How can I retrieve values from one database server and store them in other database server using PHP?
53. List out the predefined classes in PHP?
54. How can I make a script that can be bi-language (supports English, German)?
55. What are the difference between abstract class and interface?
56. How can we send mail using JavaScript?
57. How can we repair a MySQL table?
58. What are the advantages of stored procedures, triggers, indexes?
59. What is the maximum length of a table name, database name, and fieldname in MySQL?
60. How many values can the SET function of MySQL take?
61. What are the other commands to know the structure of table using MySQL commands except explain command? 
62. How many tables will create when we create table, what are they?
63. What is the purpose of the following files having extensions 1) .frm 2) .myd 3) .myi? What do these files contain?
64. What is maximum size of a database in MySQL?
65. Give the syntax of Grant and Revoke commands?
66. Explain Normalization concept?
67. How can we find the number of rows in a table using MySQL?
68. How can we find the number of rows in a result set using PHP?
69. How many ways we can we find the current date using MySQL?
70. What are the advantages and disadvantages of Cascading Style Sheets?
71. What type of inheritance that PHP supports?
72. What is the difference between Primary Key and Unique key?
73. what is garbage collection? default time ? refresh time?
74. What are the advantages/disadvantages of MySQL and PHP?
75. What is the difference between GROUP BY and ORDER BY in Sql?
76. What is the difference between char and varchar data types?
77. What is the functionality of md5 function in PHP?
78. How can I load data from a text file into a table?
79. How can we know the number of days between two given dates using MySQL?
80. How can we know the number of days between two given dates using PHP?
81. How we load all classes that placed in different directory in one PHP File , means how to do auto load classes
82. How many types of Inheritances used in PHP and how we achieve it
83. PHP how to know user has read the email?
84. What are default session time and path?
85. how to track user logged out or not? when user is idle ?
86. how to track no of user logged in ?
87. In PHP for pdf which library used?
88. for image work which library?
89. what is design pattern? singleton pattern?
90. what are magic methods?
91. what is magic quotes?
92. what is cross site scripting? SQL injection?
93. what is URL rewriting?
94. what is the major php security hole? how to avoid?
95. whether PHP supports Microsoft SQL server ?
96. what is MVC? why its been used?
97. what is framework? how it works? what is advantage?
98. what is CURL?
99. what is PDO ?
100. What is PHP's mysqli Extension?
101. What is the difference between the functions unlink and unset?
102. How can we register the variables into a session?
103. How can we destroy the session, how can we unset the variable of a session?
104. What is the difference between echo and print statement?
105. How can you enable error using PHP Code?
106. how we know browser name?
107. What function is used to convert an array into a string?
108. How can we encrypt and decrypt a data present in a mysql table using mysql?
109. What are the different database storage engines present in MySQL?
110. How can you get no of records from a table?