Here in the post Php Interview Questions and Answers for 4 Year Experience , we are posting frequently asked questions of php in interviews, exams and viva voice. The main motive of the post Php Interview Questions and Answers for 4 Year Experience to give a brief idea of questions to interviewees and students at various levels of study.
What is php?
How we write
comment in php?
What are
variables?
What are echo
command?
Define string
variables?
Write syntax
for strops() function.
Write four
comparison operators?
What is post
decrement operators.
What is
Numeric array?
Define the
term loop.
Write syntax
for request variable.
Define X+ file
mode.
Which function
is used to check the end of file?
What function
is used to check the end of file?
Define the
term queries in Mysql.
Define primary
keys.
Define Break
statements.
What do you
mean by PHP tags?
How we can echo
variables in php? Explain with the help of example?
Write a program to print “Hello
world” in php?
Mention php variables naming convention?
Explain concatenation operator?
Explain if-else statement with an
example?
What do you understand by
Anonymous function?
php interview questions and answers for 4 year experience
What are multidimensional array?
Explain the term variable
testing?
Write a program using switch case
in php?
Write difference between while
loop and do-while loop?
How we can create function in
php?Explain with the help of example?
Difference between GET and POST
method?
Brief explain various file
handling modes?
Write code in Mysql to close the
connection?
Explain where clause and order by
clause of Mysql?
What are various network
troubleshooting toold?Explain them in details?
What is Bluetooth?Writes its
various applications?
Simple PHP
script to print first ten even numbers
<?php
for($i=0;$i<=20;$i++)
{
if($i%2==0)
{
echo $i;
echo "<br>";
}
}
?>
Simple PHP
script to print first ten odd numbers
<?php
for($i=1;$i<=20;$i++)
{
if($i%2!==0)
{
echo $i;
echo "<br>";
}
}
?>
Simple PHP
script to swap two numbers using functions
<?php
$fn=10;
$sn=20;
echo
"Before Swapping no:";
echo
$fn." ".$sn;
echo
"<br>";
swap($fn,$sn);
echo
"After Swapping no:";
echo
$fn." ".$sn;
function
swap(&$x,&$y)
{
$temp=$x;
$x=$y;
$y=$temp;
}
?>
Simple PHP
script to print table of 5
<?php
$number=5;
$range=10;
for($i=1;$i<=$range;$i++)
{
echo $i*$number;
echo "<br>";
}
?>
Simple PHP
script to print factorial of 5
<?php
$number=0;
$fact=1;
for($i=$number;$i>=1;$i--)
{
$fact=$fact*$i;
}
echo $fact;
?>