×

Top 31 PHP Interview Questions for 2024

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.

Related Topics

Top 14 Elixir Interview Questions for 2024

1) What is Elixir? Elixir is a dynamic, functional language. It is designed to build scalable and maintainable applications. 2) Who developed Elixir? Ericsson developed elixir in 1986. 3) What is the stable version of...

2 minutes read.

Top 15 Java Multithreading Interview Questions for 2024

1) What is Multithreading in Java ? It is a process of executing multiple threads simultaneously. It is used to achieve multitasking. It is mostly used in animation and games etc. 2) What are...

4 minutes read.

Top 15 Java JDBC Interview Questions for 2024

1) What are the types of JDBC Drivers in Java? JDBC Drivers are of four types are: JDBC-ODBC bridge driver Native-API driver Network Protocol driver Thin driver 2) What are the five...

4 minutes read.

Top 16 WebGL Interview Questions for 2024

1) What is WebGL? WebGL stands for Web Graphics Library. It is a JavaScript API that is used for rendering 3D graphic in any compatible web browser. It is written in...

3 minutes read.

WebSockets Interview Questions

1) What is Web Sockets? Web Sockets is a two way communication between the clients and the servers. Here, the clients and servers both the parties can communicate and exchange data...

3 minutes read.

Top 15 Xamarin Interview Questions for 2024

1) What is Xamarin? Xamarin is a .NET framework. It allows to create an application that run on multiple platforms. Xamarin Tutorial uses C# language and .NET framework to deliver native...

2 minutes read.

Top 22 DOJO Interview Questions for 2024

1) What is DOJO? DOJO is an open source JavaScript framework designed for very fast development of JavaScript/AJAX based application and websites having cross platform interdependencies. 2) Enlist all features of DOJO. ...

4 minutes read.

Top 25 R programming Language Interview Questions for 2024

1) What is R programming language? R is an open source programming language. It is software environment for statistical computing and graphics. It compiles and runs on a wide variety of...

4 minutes read.

Top 19 Google Maps Interview Questions for 2024

1) What is Google Maps? Google Maps is a web-based service developed by Google. It contains geographical information and provides routes and information to the client. 2) What are the features provided...

5 minutes read.

Top 14 MathML Interview Questions for 2024

1) What is MathML? MathL stands for Mathematical Markup Language. It is extended form of XML. It is used to describe mathematical and scientific notations. 2) Who is the developer of MathML? World...

3 minutes read.

Top 15 Highcharts Interview Questions for 2024

1) What is Highcharts? Highcharts is a JavaScript based charting library. It is used to enhance web applications by adding interactive charting capability. Highcharts supports a wide range of charts. Charts are drawn using...

2 minutes read.

A to Z Interview Questions

ABCDEFGHIJKLMNOPQRSTUVWXYZ Interview Questions and Answers List A 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 B Blockchain Interview...

3 minutes read.

Top 27 JavaScript Interview Questions for 2024

1) Define Undeclared and Undefined Variables? Undeclared variable are defined as these variable is neither defined nor exist in the program. If program calls this variable then it causes Runtime error. Undefined variable...

5 minutes read.

Top 18 Blockchain Interview Questions and Answers for 2024

Top 20 Commonly Asked Blockchain Interview Questions and Answers 1. What do you understand by Blockchain? Blockchain is a chain of blocks made up of digital pieces of information or can be defined as...

6 minutes read.

Top 30 Sencha Touch Interview Questions for 2024

1) What is Sencha Touch? Sencha Touch is an UI (User Interface) JavaScript library. It is written in JavaScript. It is used to build mobile interface quickly and easily. It works...

6 minutes read.

Top 40 TensorFlow Interview Questions and Answers

Commonly Asked TensorFlow Interview Questions for Fresher Q1. What is TensorFlow? TensorFlow is the machine learning library developed by Google's brain team, it supports multiple abstraction levels, and we can choose the...

13 minutes read.

Top 15 Electron Interview Question for 2024

1) What is Electron? Electron is an open source library developed by Github. It is used to develop cross platform desktop application. 2) Which technology Electron uses? Electron uses Chromium and Node.js with...

3 minutes read.

Top 15 RequireJs Interview Questions for 2024

1) What is RequireJs? RequireJs is a open source JavaScript library which is used to maintain dependencies between JavaScript files and modular programming. 2) What are the features of RequireJs? Following are the...

3 minutes read.

Top 30 Joomla Interview Questions for 2024

1) What is Joomla? Joomla is an open source content management system. It is used to build online applications and websites. It uses model-view-controller (MVC) web application framework. It is free and easy to...

4 minutes read.

Top 28 Firebase Interview Questions for 2024

1) What is Firebase? Firebase is a platform which is used for building Web, IOS and Android applications. It offers: Real time database Different APIs Multiple authentication types and Hosting platform 2) What are the features of...

3 minutes read.