PHP interview Question with answer
1)<?php$varA=one;
$varB=&$varA;
$varA=two;
print $varB;
?>
Output:
2
It is result is Two because $varB holds the reference of $varA value an dboth $varA and $varB poin the same value.
2)<?php
$num1=6;
$num2=5;
$val=(num1>$num2)?$num1:$num2;
echo "Greatest of no".$val;num2;
?>
Output:
6
It is greatest of two number in the given number.
3)what is print_r()?
The print_r() is used to print out the entire content of array.
<?php
$fruit=array("orange","apple","mango");
print_r($fruit);
?>
4)What happened below code
<?php
print "type(152).gettype(152)."\n";
?>
Answer:
it is return the 152 as an Integer value.gettype() is used to get the datatype.
5)How do find the Ip address of remote machine?
Answer:
<?php
echo "your ip address is ".$SERVER['REMOTE_ADDR'];
?>
6)<?php
echo ucfirst("helloworld");
?>
what happened in this code?
Answer:
It is return the output Hello world.the ucfirst() is used to convert the first character in to Uppercase.
7)Difference between include() and require()?
In include() function if can't include the file it is generate error but continue the execution of program but require() function if can't include the file it is generate fatal error in script.
8)How destroy the session in PHP?
In session we are using unset() or session_destroy() function which is used to destroy the session in PHP.
9)What is use of explode() in PHP?
explode() function is used to convert string into array.
10)How do connect PHP with Mysql query?
$mysql_connect("address","username","password")
2 comments:
m
Hi, friends
The post is really awesome with lots of information inside. It has knowledgeable post.
Thanks a lot for posting this
Free English Speaking Course in India
Post a Comment