PHP Interview Questions

Frequently Asked PHP Interview Questions:

1. What is PHP?

  • The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases.
  • PHP is basically used for developing web-based software applications.
  • The PHP code is executed on the server, and the result is returned to the browser as plain HTML
  • PHP files have extension “.php”.
  • PHP runs on all major operating systems(Windows, Linux, Unix, Mac OS X, etc.)
  • PHP supports most of the web servers(Apache, IIS, etc.).
  • Most significant features in PHP is its support for a wide range of databases.

2. What is the Scope Resolution Operator in PHP?

  • The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon.
  • The scope resolution operators are used to access the static, constant, overridden  properties and methods of classes.

Example:

3. What is PEAR in PHP?

  • PEAR – PHP Extension and Application Repository.
  • PEAR is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated wizard, and packing the strength and experience of PHP users into a nicely organised OOP library.
  • PEAR also provides a command-line interface that can be used to automatically install “packages”.

4. What’s the difference between the include() and require() functions?

include() and require() both are used to include a file but when you include file using require() and then file does not exist then it will give the fatal error and stop the execution of script while include() only gives warning and script will continue.

Syntax:

Gaurav Kumar

Hi, my name is Gaurav Kumar and I specialize in the Computer Software industry. I have been working as a Software Developer, and it's my passion to learn new things and sharing what I've learned.