Home >>Interview Questions >PHP Interview Question and Answers
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.
Ans. PHP was developed by Rasmus Lerdorf in 1994.
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.
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.
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 .
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.
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.
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.
Ans. Unlink( ) function is used to delete the files while unset( ) function makes a variable undefined.
Ans. $_SERVER['HTTP_USER_AGENT'] global variable is used to get the browser properties.
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.
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;
Ans. The session_id( ) function is used to get the current session id. It returns the session id for the current session.
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