PHP Interview Top Questions
Q No. 1: Difference
between $var and $$var ??
Ans: $var is
php variable but $$var is reference variable. For example if $var= “John” and
$$var = “Kate” then $John value is Kate.
QNo 2: Difference
between $_GET and $_POST??
Ans: In $_GET
method the requested data is shown in the URL but in $_POST the data is hidden
in the URL. In $_GET there are limitations on the sending data but in $_POST
there are no limit.
Difference between $_GET and $_POSTmethod
Difference between $_GET and $_POSTmethod
QNo 3: Difference
between include and require??
Ans: Both are
used to include the file but when file is not found then include sends warning
whereas require sends fatal error
QNo 4: Why
htaccess is used for??
Ans: htaccess files are Apache server configuration files and these
are used to make changes on a per directory basis. These are placed in a
particular directory and directive applies to that directory.
QNo 5: Can you
compare an integer 12 and string “13” in php??
Ans: Off course,
you can compare because these two are numbers. Just their types are different.
QNo 6: Find the
numbers of parameters in the fun??
Ans: fun_num_arg
() function gives the number of parameters passed in the fun.
QNo 7: Difference
between character 24 and x24??
Ans: character
24 is octal and x24 is the hex 24 in PHP
QNo 8: What is
MVC??
Ans: MVC is
Model , View and Controller and it is used to arrange your code in three parts.
Model: It contains the logic code
View: it contains the interface in .html, .xml form
Controller: Call of both model and view when it’s needed
Model: It contains the logic code
View: it contains the interface in .html, .xml form
Controller: Call of both model and view when it’s needed
QNo 9: What is
Polymorphism??
Ans: Many
forms of an object like motor_bike class can be extended into “Yamaha” and “Suzuki”
QNo 10: Why
ob_start() and ob_get_clean() is used??
Ans: ob_start
is used to buffer the output and ob_get_clean is used to stop the buffering.
Here is an example:
<?php ob_start();
echo “Hello World”;
?>
Thanx
<?php $content=ob_get_clean(); ?>
So the content of the $content will be
Hello World
Thanx
<?php ob_start();
echo “Hello World”;
?>
Thanx
<?php $content=ob_get_clean(); ?>
So the content of the $content will be
Hello World
Thanx
Final Words
If you want to ask any other question then you can simply use
comment section. I will try to reply you soon. Stay Blessed.

