PHP Interview Question Answer
What is the purpose of php.ini file?

php.ini is a default configuration file require for running application, we edit this as per our requirement
In xampp we can see this file on xampp->php->php.ini

Some php.ini setting we can do.

Increase memory limit
we can enable short tag
we can change max_execution_time
To enable or disable display error,log error,html error, log error ...
We can increase or decrease File uploading size
We can increase or decrease Maximum number of file upload
we can add/remove/comment extension like extension=php_mbstring.dll

How can we remove HTML Tags from Data?

Strip_tags() function

How can we define a constant PHP?

define() is use to define constant

Example
define ("Salary",5000);

What is a Persistent Cookie?

A persistent cookie is permanently stored on Client computer this will create notepad file, But temporary cookie erased when we close broswer.

For Permanent cookie we use set_cookie()

For Temporary cookie we use $_SESSION[]

Full Form of PHP Open source softwares

XAMPP stands for Cross-Platform (X), Apache (A), MySQL (M), PHP (P) and Perl (P)
WAMP stands for Windows (W), Apache (A), MySQL (M) and PHP(P)
LAMP stands for Linux (L), Apache (A), MySQL (M) and PHP(P)
MacOS stands for MacOS (M), Apache (A), MySQL (M) and PHP(P)

Mysql Query to Find 2nd hightest salary from the employee table

Query1
SELECT DISTINCT salary FROM emp ORDER by salary desc LIMIT 1,1

Query2
SELECT MAX(salary) as salary FROM emp WHERE salary<(select MAX(salary) from emp);

Query3
SELECT salary FROM emp
WHERE salary = (SELECT (salary) FROM emp GROUP BY salary DESC LIMIT 1,1)

All above these query doing same work.

Swap two value without using third variable

Code 1

<?php
$a=5;
$b=6;
$a=$a+$b;
$b=$a-$b;
$a=$a-$b;
echo $a;
echo "<br>";
echo $b;
?>

Code 2

<?php
$a=5;
$b=6;
list($a,$b)=array($b,$a);
echo $a;
echo "<br>";
echo $b;
?>

What is the difference between == and === operator?

== equal operator is use to check two value is equal or not. If we use === operator then it will check two value is equal with same data type

What is default session time?

24 minutes(1440 seconds)

what is the difference between include and include_once?

Include We include file many times in single script. Include_once This will include file only one time, second if we include this file this will be ignore

List data types in PHP ?

integer
boolean
float
string
array
object
callable
resource
NULL


Next

Share on Facebook
Success Story
Mamta kushwaha
Avatar
Seo executive
India webpoint
Many of my relatives were in good jobs than what I had and my parents were worried about me. I was confident to find some way to get a better position. Then I found that the training through It and Dc was happy for the decision. I have my own business now and I am doing good in developing clients’sites to earn profits to make my parents happy.
Manikant kumar
Avatar
PHP Developer
Fourtek IT Solution PVT LTD
The regular knowledge at IT and DC gave me the confidence to approach the best companies and I found the position in the corporate world I had been trying to get for a long time. The work that I do now satisfies me and gives me inspiration to perform better. I got this strength from It and Dc when I was put under training in PHP and web development at the institute.
Sponsored Ads