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.

Live Demo and download the script please click here

  • vivek

    Hi,i want to learn magento can you tell me any book

  • phptpoint

    Thanks dear,
    and if you have any query regarding php interview question please let me know
    though ask your question.

  • phptpoint

    thank you..

  • phptpoint

    to get your blog in rank you can use All in one SEO plugins…………

  • phptpoint

    Thank you for appreciating us,
    You have any query regarding PHP Please discuss through our Discussion Forum

    • hi,this is very good.i understand every sentence.

  • Jannet Roselin

    Very nice blogg…………very useful for beginners

  • sanjeev

    sir plz send online shopping project in php.Thans

  • saravanan

    i’m final yr student of cse & i want to develop mt project in php with mysql
    these q&a’s are useful for my projects and interview point of view

  • Anita

    Gud evng sir,
    can u give me a project of Online Shopping in PHP sir.

    • as soon as possible i will upload the project.

  • Gud evng sir,
    can u give me a project of Online Shopping in PHP sir

  • pavan

    sir can u send me a school and hostel management project

  • best site for lerning php

  • Sukhbir

    helpful for beginners as well as experienced thanks phptpoint team

  • senthil

    i want to learn css,javascript,ajax can you tell me any book
    pls send link in my mail

  • mayur singh

    thankz phptpoint …..its reaally very easy to undersrand all the concept..

  • Sahil Srivastav

    Best site for beginners as well as experienced thanks phptpoint team.

  • Good Blog ….

  • Aatif Khan

    best ever site

  • Mirza Mohsin Raza

    Dear Sir,
    Why use in xamp server .htaccess file

    • .htaccess is used for URL rewriting.
      if you are talking about htdocs then its root directory XAMPP server where u have to put all your projects

  • wasim

    Dear sir,
    how to create category and subcategory?and how to display dropdown form?

  • Shoaib Athar

    Sir ,
    its showing 100 interview question in link ,but here is only 15 .

  • Some of the questions are really cool as I recall them from my recent telephonic interview. And all in all, a very balanced and a nice read.