In this post we will see some of important or advance core PHP developer Interview Questions with Answers, Which are generally asked in interview by IT companies. 

We have added some of basic questions also for beginners or freshers.And freshers can also check  PHP TUTORIAL FOR BEGINEER  before reading PHP developer questions and answers. PHP programming language is a big player of web life.So if you want to make your career as WEB Developer then you should know basic of PHP anyhow. For all interviewer please read all below questions before attending interview.


1)  What is PHP?

a>PHP is one of the most Web Development programming languages.
b>PHP is also known as server side scripting language that allows developers to create dynamic web pages.
c>PHP is Open Source.It is also an object oriented programming language like java.

2)  What does the initials of PHP stand for?

PHP stand for “PHP Hypertext Preprocessor”.

3)  What is the use of “echo” in php?

Echo is a statement used to display result on screen. It can be used with parentheses or without parentheses.

Example of PHP echo statement:-

Output for above script:- 

Car insurance

4)  What does PEAR stands for?

a>PEAR stands for  “PHP Extension and Application Repository”.
b>It extends PHP script and provides a higher level of programming for web developers.It support for code distribution and package maintenance.

5)  Does PHP language support multiple inheritance or not ?

No, PHP does not support multiple inheritance.It only support single inheritance by use of ‘extend‘ ,Means one class can only extend one class at a time.

6)  How to include a file in PHP file or page?

We can include a file by using “include() ” or “require()” PHP function with file path as its parameter.

For example:- (Suppose we want to include a test.php file then we use below code)

7)  How to define a constant in PHP language?

We use Define() function to define constant in PHP Language or script.

For example:


8)  What are the different types of error in PHP language ?

Notice error: This is small and non critical error – For example: accessing a variable ,which is not defined.
Warning error :Warning errors are more serious errors – For example:Trying to include() a file which  does not exist.
Fatal error : Fatal errors are critical errors – For example: Instantiating an object of a non-existent class, or calling a non-existent function.

9)  Difference between the implode() and explode() function ?

Impload() function : The implode function is used to join elements of array with a string.

For example:-

Output for above script:


Explode() function : it basically breaks a string into an array.The explode function is used to split a string into pieces by a specified string and convert to array.


OUTPUT of above script:-
[0] => WEBS
[1] => NUBE

10)  How will you concatenate two string in PHP ?

For concatenating two or more string , we use the dot (.) operator.

For example:-

Output of above script will be:


11)  What is MVC in PHP ?

MVC stands for Model, View and Controller. MVC is architecture of any framework in PHP.
Model: The Model is the part of the MVC application that handles the logic for the application data.
View :The View is the parts of the application that handles the display of the data.
Controller :The Controller is the part of the application that handles user interaction.

12)  Difference between the require() and include() function in PHP ?

require function: If the file is not found by require() function, it will cause a fatal error and halt the execution of the script.

include function: If the file is not found by include() function, a warning will be issued, but execution will continue.

13)  What are the magic functions present in PHP ?

Magic functions are in PHP:

__construc,  __get,  __destruct,  __call,  __sleep,  __clone,  __toString,  __set.

14)  What is Session in Web development or PHP ?

A PHP session is variable ,which is used to store information about, or change settings for a user  session.

15)  What is Cookies in Web development or PHP ?

 A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user’s computer.

16)  Difference between the Session and Cookies in PHP or web development ?

 Difference between a session and a cookie is that:

Session data is stored on the server,whereas Cookies store data in the visitor’s browser.

17)  How to create or set a Cookie in PHP  ?

The setcookie() function is used to set a cookie.


setcookie(name, value, expire, path, domain);

For Example: –

In the example below, we will create a cookie named “user” and assign the value “WebsNube” to it.We also specify that the cookie should expire after one hour:

18)  How to Retrieve a Cookie Value in PHP  ?

The PHP $_COOKIE variable is used to retrieve a cookie value.

For Example:

In the example below, we retrieve the value of the cookie named “user” and display it on a page.

19)  What is difference the between POST and GET http request method ?

Difference are :

a>POST is more secure than GET because Your information will be hide during performing of POST operation.

b>GET has limitation You can only pass 255 character query string BUT in POST there is no limitation.

20)  How to use GLOBAL Variable in PHP ?

GLOBAL variable can be accessed in any part of the program.

For example:-

Below by declaring $a and $b global within the function, both variable will refer to the global version.

Output of above script :-


21)  How can we get ‘ second ‘of the current time using date function ?

We use date() method to get second of current date:

For example: 

$second = date(“s”);

echo $second.

Other important questions are coming soooon….please visit always this post to get IT company intervies questions

php interview questions and answers for freshers and experience

You can see our PHP Tutorial for fresher and experience developer: 

<<<<< PHP tutorial for beginner Day 4 –  Echo and Print operation in PHP

<<<<< PHP tutorial for beginner Day 3 –  variable scope and type of variable

<<<<< PHP tutorial for beginner Day 2 – Syntax overview and tag

<<<<< PHP tutorial for beginner Day 1 – Introduction and Installation.