Top PHP Interview Questions And Answers

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.

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.

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.

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.

How can we get the  properties  of browswer?

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

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;

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.

 What are the popular Content Management Systems (CMS) in PHP?

  • WordPress: WordPress is a free and open-source content management system (CMS) based on PHP & MySQL. It includes a plug-in architecture and template system. It is mostly connected with blogging but supports another kind of web content, containing more traditional mailing lists and forums, media displays, and online stores.
  • Joomla: Joomla is a free and open-source content management system (CMS) for distributing web content, created by Open Source Matters, Inc. It is based on a model-view-controller web application framework that can be used independently of the CMS.
  • Magento: Magento is an open source E-trade programming, made by Varien Inc., which is valuable for online business. It has a flexible measured design and is versatile with many control alternatives that are useful for clients. Magento utilizes E-trade stage which offers organization extreme E-business arrangements and extensive support network.
  • Drupal: Drupal is a CMS platform developed in PHP and distributed under the GNU (General Public License).

 Is multiple inheritance supported in PHP?

PHP supports only single inheritance; it means that a class can be extended from only one single class using the keyword ‘extended’.

 What is the meaning of a final class and a final method?

‘final’ is introduced in PHP5. Final class means that this class cannot be extended and a final method cannot be overridden.

What are the functions to be used to get the image’s properties (size, width, and height)?

The functions are getimagesize() for size, imagesx() for width and imagesy() for height.

 What is the main difference between require() and require_once()?

require(), and require_once() perform the same task except that the second function checks if the PHP script is already included or not before executing it.

(same for include_once() and include())


Leave a Reply

Your email address will not be published. Required fields are marked *