Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions Network Architect Interview Questions

Top 31 PHP Interview Questions for 2021

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.

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:

count()

array()

sort()

array_search()

array_intersect()

array_chunk()

array_reverse()

array_change_key_case()

10) What are the string functions used in PHP ?

PHP string functions:

strlen()

strrev()

ucwords()

ucfirst()

lcfirst()

strtolower()

strtoupper() etc

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

Types of PHP operators:

Comparison Operators

Bitwise Operators

Execution Operators

Assignment Operators

Array Operators

Arithmetic Operators

String Operators

Logical Operators etc

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

Example:

<?php    

echo "PHP DEVELOPER";    

?>

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

<?php    

for($i=1;$i<=2;$i++)  

{    

for($j=1;$j<=2;$j++)  

{    

echo "$i   $j";  

}   

}   

?>

Output:

1   11   22   12   2

14) what types of loops exist in php?

Types of loops in PHP are:

for

while

do while

foreach

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

<?php        

$num=300;        

switch($num)  

{        

case 100:        

echo("Result of 100 students");        

break;        

case 200:        

echo("Result of 200 students");        

break;        

case 300:        

echo("Result of 300 students");        

break;        

default:        

echo("Result Not Found");        

}       

?>

Output:

Result of 300 students

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:

<?php echo "HELLO"; ?>

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:

Single Line comment [ //hello and # hello ]

Multiline comment [ /* ……HELLO……. ]

24) Is PHP case sensitive language?

Yes, PHP is case sensitive language.

Example

<?php  

         $capital = 67;  

         print("Variable capital is $capital<br>");  

         print("Variable CaPiTaL is $CaPiTaL<br>");  

?>

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

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

Example

<?php     $x=9   echo ?$x?; ?>

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 StatementPrint statement
It is used to output data to the screenIt is as same as echo.
It does not return valueIt 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.