Php Interview Questions

1) What is PHP?

PHP is a object-oriented scripting language, open source, interpreted and executed at server side.

It is also used to develop web applications.

2) What are the features of PHP?

Features of PHP are:

  • Platform Independent
  • Fast Performance
  • Compatibility
  • Open Source
  • Embedded

3) What was the old name of PHP?

Personal Home Page is the old name of PHP.

4) What are the popular Content Management Systems in PHP?

The popular Content Management System in PHP are:

  • Drupal
  • Joomla
  • WordPress
  • Magento

5) What are the types of frameworks used in PHP?

PHP frameworks are:

  • CodeIgniter
  • Symfony
  • CakePHP
  • Zend Framework
  • Yii 2 etc

6) What are the ways to define a constant in PHP?

There are two ways to define a constant in PHP are:

  • By using const() function
  • By using define() function

7) How many data types are there in PHP?

There are three types of data types used in PHP are:

1) Compound types

  • array
  • object

2) Scalar types

  • integer
  • float
  • string
  • boolean

3) Special types

  • NULL
  • resource

8) How many types of array are there in PHP?

Types of array in PHP are:

  • Associative array
  • Multidimensional array
  • Indexed array

9) Explain some of the PHP array functions?

PHP array functions are:

10) What are the string functions used in PHP ?

PHP string functions:

 

11) How many types of operator are there in PHP?

Types of PHP operators:

12) Write a simple program in PHP to print “PHP DEVELOPER”?

Example:

13) What will be the output of the following code snippet?

Output:

14) what types of loops exist in php?

Types of loops in PHP are:

15) What will be the output of the following code snippet?

Output:

17) Who is the father of PHP?

Rasmus Lerdorf is the father of PHP.

18) Does PHP support multiple databases?

Yes PHP supports multiple languages like MySQL, PostgreSQL, Oracle, Sybase and many more.

19) What are the protocols supported by PHP?

There are various protocols supported by PHP like POP3, IMAP, LDAP etc.

20) What are the characteristic of PHP?

The characteristics of PHP are given below:

  • Simplicity
  • Efficiency
  • Security
  • Flexibility
  • Familiarity

21) What is the common tag while using PHP?

The common tag while using PHP is: <?php…?>.

Example:

22) What are the components while develop and run web pages?

There are three components while develop and run web pages.

  • Web server
  • Database
  • PHP Parser

23) What are the ways to comment PHP Code?

There are following ways to comment PHP Code:

24) Is PHP case sensitive language?

Yes, PHP is case sensitive language.

Example

25) Which symbol is used to declare the variable in PHP?

In PHP, the $ (Dollar) symbol is used to declare the variable.

Example

26) What is the use count () functions in PHP?

IN PHP, count function is used to count the total elements of an array.

27) What is the use of isset() function?

The isset() function is used to check the variable that define or not and not null.

28) How many types of an array in PHP?

In PHP, there are three types of an array that are given below:

  • Indexed array
  • Associative array
  • Multidimensional array

29) What are the methods to submit the form in PHP?

There are two methods to submit the form in PHP that are GET and POST.

30) Is PHP a loosely typed language?

Yes, PHP is a loosely typed language.

31) What are the differences between echo and print statement?

The differences between echo and print statement are given below:

Echo Statement Print statement
It is used to output data to the screen It is as same as echo.
It does not return value It returns the value.
It can take multiple parameters. It can take only single parameter.
It is marginally faster than print. It not faster than echo.

Leave a Comment