Home >>Interview Questions >PHP Interview Question and Answers

PHP Interview Question and Answers

PHP Interview Questions and Answers

PHP Interview Questions and Answers

Q.1- What is PHP ?

Ans. The PHP  is the server side scripting  language that is used to develop attractive and   dynamic web application. It is  used for developing web based dynamic applications.

Q.2-PHP was  developed by whom and When?

Ans. PHP was developed by Rasmus Lerdorf  in 1994.

Q.3 What is the difference between PHP4 and PHP5?

Ans. PHP5 supports oops concept while PHP4 doesn’t support oops concepts. PHP5 error handling is better than PHP4’s error handling . PHP 5 shows function’s parameter hint while PHP 4 doesn’t show.

Q.4 What is the difference between echo and print

Ans. Echo and print both are the PHP statement that is used to display the output. Multiplie argument can pass separated by , in echo statement. But using print statement single argument can pass. Echo is faster than print statement. Print returns always true while echo doesn’t return any value.

Q.5- What is the difference between $var and $$var?

Ans. $var is a simple variable while $$var is known as reference variable. $var = “Sanjeev”; $$var = “is a PHPXperts”; $var is a simple PHP variable that we are used to. But the $$var is not very familiar like $var. It creates a variable name $Sanjeev with the value “is f PHPXperts.” Assigned . break it like this ${$var} => $Sanjeev .

Q.6 What are the differences between GET and POST methods.

Ans. Get is a unsecured method because it displays all the information in address-bar(url) while POST hides all the information so it is secure method. By default method is GET method. Get is the faster than POST method because get can carry limited amount of data while POST can carry unlimited data.

Q.7- What are the differences between require and include.

Ans : require and include both are used to include external PHP files. Require says a page must be developed, if a page is not developed yet then it shows fatal error that is the cause if script termination. While include says a page should be developed, if a page is not developed yet it shows warning error which doesn’t terminates your script.

Q.8 What are the different types of errors in PHP?

Ans. Three are three types of errors in php : 1. Notices: variable is undefined. 2.Warning: it is not critical error. it gives permission execute the script but shows warning message that means there is still a error. 2. Fatal : it is critical error because it stops the execution of the script.

.Q.9 What is the difference between  unlink and unset function?

Ans. Unlink( ) function is used to delete the files while unset( ) function makes a variable undefined.

Q.11 How can we get the  properties  of browswer?

Ans. $_SERVER['HTTP_USER_AGENT'] global variable is used to get the browser properties.

Q.12 What is the maximum  filesize that can be uploaded in PHP and how can we increase it?

Ans. By default the maximum size of a file that can be uploaded is 2MB. you can change the maximum uploaded size value inside php.ini file set the value upload_max_filesize = 5M and restart all the services.

Q.13 How can we increase the execution time of  PHP ?

Ans.By default the maximum execution time of a PHP script is 30sec. If you want to change the following setup go inside php.ini file set max_execution_time = 40;

Q.14 How can we get the value of current session id?

Ans. The session_id( ) function is used to get the current session id. It returns the session id for the current session.

Q.15 How can we submit a html form without a submit button

Ans. The submit( ) function is used to submit form. first you have to get html form id through this document.getElementById("formId").submit() and then use submit( ) function. call this javascript function inside html body section at onclick="your funciton name( )" events. set form action when you want to display the output, fetch the data on php and display your output.

Total Downloads : 403

Login / Register To Download

No Sidebar ads