PHP interview questions for freshers/beginners

What is the full form of PHP?

Php stands for Hypertext Preprocessor.
What is Zend engine?

Zend is used internally by PHP as a compiler and as a runtime engine.

What is MIME?

MIME is Multipurpose Internet mail extensions. It classifies files over internet.

Difference between echo() and print()?

Echo can take increased expression while print can not take multiple expressions.

Echo return true /false on success /failure while print does not return true or false condition.

Latest PHP version?

The latest version of PHP is PHP 7.

Features of PHP and its advantages?

It is case sensitive, both upper and lower cases both are different.

It is an error sensitive language.

To print anything in PHP, we need to use print or echo function.

PHP pages are saved by .php extensions.

Advantages of PHP:-

Easy to understand and Code.

It is an open source language; no license is required to work on it.

PHP development is cheaper than other programming languages like C, C++, Java, etc.

PHP scripts consume less server space that boosts software/Web performance.

Drawbacks of PHP?

Php is less secure than Java and other object-oriented languages.

For more variations and creativity, one must know Perl or Python scripting.

How many types of methods are there in PHP?

Get, Post, And a request.

Properties of GET, POST, & REQUEST methods? 


It is a faster data transfer method.

You can send up to 255 character length data using GET method.

It feeds input information in the URL that makes it an insecure data requesting/transferring method.

We can send text through Getting method.


POST method sends/transfers data in an encapsulated form that hides data visibility via the URL.

As it sends the data in an encapsulated form, there is no data transfer limitation. You can send unlimited data using POST method.

Encapsulation and massive data transfer make it a slow transfer method.

.we can send attachments too.E.g files, images, etc.


.Request method is used when we forget which method we have used for client side scripting.

.By default it works as a get method.

What are variables?

Variables are those whose value changes at run time.

What are constants?

Constants are those whose value is fixed during the time of execution.

What is a $ symbol in PHP?

$ represents a variable.
For eg->$a=10; represents variable a.

what is $$?

$$ is a reference variable or variable of variable.

functions of php?

There are four functions of PHP:-




Auto refresh().

How many types of fetching methods used in PHP to retrieve data from the database?

There are four types of fetching methods to retrieve data from database namely:-





How fetching is done by array?

mysql_fetch_array() fetch data via both Associcative and numeric array.

syntax for numeric array:- <?php $echo row[0]; ?> <?php $echo row[1];?>.

synatx for associative array:- <?php $echo row[id]; ?> <?php $echo row[password]; ?>.
How fetching is done by association?

mysql_fetch_assoc() fetch data via associative array.

syntax :-<?php $echo row[id];?>

How fetching is done by association?

mysql_fetch_row() fetch data via numeric array.

syntax :-<?php $echo row[o];?>.
php interview questions.
php interview questions.
How fetching is done by association?

mysql_fetch_object() fetch data via pointer.

syntax :-<?PHP $echo row->id?>

what are joins

Joins .’ the record from one or more tables.

How can we declare constant in php?

we can declare constant in php by using define function.

syntax:- <?php define(“name”,”value”); ?>
database connectivity in php?


$db=mysql_select_db(“table name”,$link”);

$qre=mysql_query(insert values into table1 where(row1=’$row1′));

arrays and types?

array:-Array is a collection of multiple values in a single variable.

Types of arrays are as follows:-

1-d array.

Numeric array.

Collective array.

Associative arrays.

String and types?

String: -String is a collection of characters.

There are many types of strings some common string types are as follows:-






what is implode?

Implode is used to convert values of array into string.



echo implode(” ” ,$array);


what is explode?

Explode is used to convert strings into arrays.


$string=”hello m akshay”:

print_r explode(” “,$string);


what is a cookie?

A cookie is a small file integrated into our browser that stores our activity records. 

Types of cookies?

There are two types of cookies:-

Persistent cookie: -Persistent cookie is a permanent cookie due to which it remember the user on its another arrival on the website.

Session Cookie: – A web page cannot trace the activity of user when he/she change the web page of a website, to remember the visitor on change of web page session cookie is used.

What is cookie profiling?

It is also known as web profiling.It uses the persistent cookie to track all activities of the user.

What is the mechanism of a cookie?

A cookie is a small file attached on the client side that stores all the activities of the user on a particular website.

What is third-party ad server?

Third-party the means ads shown on the web page are from another server and the content from the website which we are using.

What is a session?

Let us understand it with an example. Suppose, I log in to Facebook, spent 15 minutes there, and then I logged out my FB account. This 15-minute period is known as the session. 


What must be the default value to upload a file?

2MB is the default value.

types of errors in PHP?

Php has three error types. Explore the list below:-

notice: -These are trivial,non-critical mistakes that PHP encountered during the execution of a script.

For e.g->Accessing variables which are not defined.

Fatal: – These are the critical errors in which programs gets terminated by itself or by the operating systems.

e.g.->Calling a non-existence function.

Warning: -These are more serious errors occurs when we attempt to include anything which is not in existence.

e.g.->including a file which is not in existence.

isset function?

Isset functions determine wheater a variable is set and is not null.

What is Wamp, Lamp, Xamp?

Wamp: -Windows Apache MySQL PHP.It is a software consists of Windows operating system, Apache server, MySQL, and PHP.
Php interview questions.
Lamp: -Linux Apache MySQL pop.It is a software consist of the Linux operating system, Apache server, MySQL, and PHP.
Php interview questions.
Xamp: -cross Apache MySQL PHP.It is a cross-platform software for Windows and Linux.
Php interview questions.
Explain. Urlencode and URL decode?

Urlencode -encodes string used in the query part of URL.

Urldecode: -decode string used in the query part of URL.

How to send session id, if cookies are disabled? 

Session ID can be sent directly via the URL.

How will you send data without a submit button?

We can send data using javascript or header file.
Php interview questions