PHP Interview Question and Answers

 

What is PHP?

PHP is web language which is used to write scripts. Web developers use PHP to create dynamically generated web pages.

 

What is PHP Stands for?

PHP stands for Hypertext Preprocessor.

 

Does PHP support multiple inheritance?

PHP only supports single inheritance by using the keyword ‘extended’.

 

How PHP will interact with HTML?

It is possible to pass pieces of information. It is possible we can generate HTML file through PHP scripts.

 

What are the frameworks in PHP?

Symfony, CodeIgniter, CakePHP, Yii 2, Zend Framework, etc.

 

What is Echo in PHP?

It outputs one or more string. It is a language and it is not a function so the use of parenthesis is not required. If we want more than one parameter to echo then parenthesis is required.

 

How to declare a variable in PHP?

A variable is a temporary storage area. It is used to store data. To declare a variable we use the syntax

$variable = value;

 

How to define a constant in PHP?

Constants cannot be changed during the execution of the script. They can be defined in two ways.

  • Using define() function
  • Using const() function

 

What are the data types supported by PHP?

They are used to hold different data values or different types.  PHP consists of 8 primitive data types, they are further classified into three types.

  • Scalar types
  • Compound types
  • Special types

 

Click here to learn more about PHP