Interview questions for php

1. What is PHP?

PHP stands for Hypertext Preprocessor. It is an open source server-side scripting language which is widely used for web development. It supports many databases like MySQL, Oracle, Sybase, Solid, PostgreSQL, generic ODBC etc.

2. What is PEAR in PHP?

PEAR is a framework and repository for reusable PHP components. PEAR stands for PHP Extension and Application Repository. It contains all types of PHP code snippets and libraries.

It also provides a command line interface to install “packages” automatically.

3. Explain the difference b/w static and dynamic websites?

In static websites, content can’t be changed after running the script. You can’t change anything on the site. It is predefined.

In dynamic websites, content of script can be changed at the run time. Its content is regenerated every time a user visit or reload. Google, yahoo and every search engine is the example of dynamic website.

4. 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).

5. List some of the features of PHP7?

  • Scalar type declarations
  • Return type declarations
  • Null coalescing operator (??)
  • Spaceship operator
  • Constant arrays using define()
  • Anonymous classes
  • Closure::call method
  • Group use declaration
  • Generator return expressions
  • Generator delegation
  • Space ship operator

6. What’s the difference between include and require?

If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.

7. Require_once(), require(), include().What is difference between them?

require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page). So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don’t include the file more times and you will not get the “function re-declared” error.

8. How can PHP interact to Javascript ?

PHP cannot interact with javascript directly, since php is server side programming language when javascript is a client side programming language. However we can embbed the php variable values to a javascript code section when it complile at the server or javascript can communicate to a php page via http calls

NB: Javascript can run at the server side as well using Node.js Server

9. How to manipulate image files using php ?

GD is library that providing image manipulation capabilities to php, so that we can do so many things such as crop, merge, change grayscale and much more with GD functions

10. How to manipulate video files using php ?

There is no inbuilt library available in php, However there are some open source libraries that providing these features

FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. We can install this extension in php and use to do variety of tasks.

leave your comment


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