PHP MCQ Question and Answer
PHP MCQ Question and Answer
101. what is the return value of this substr function?
<?php
$rest = substr("abcdef", -1);
$rest = substr("abcdef", 0, -1);
?>
<?php
$rest = substr("abcdef", -1);
$rest = substr("abcdef", 0, -1);
?>
- f,abcde
- a,fedcb
- b,abcdef
- a,abcde
102. Assume that your php file 'index.php' in location c:/apache/htdocs/phptutor/index.php. If you used basename($_SERVER['PHP_SELF']) function in your page, then what is the return value of this function ?
- phptutor
- phptutor/index.php
- index.php
- /index.php
103. $x="display";
${$x.'_result'} ();
?>
Above program will call the function display_result()
${$x.'_result'} ();
?>
Above program will call the function display_result()
- False
- True
- Parser Error
- None of the above
107. $str="3dollars";
$a=20;
$a+=$str;
print($a);
?>
Output ?
$a=20;
$a+=$str;
print($a);
?>
Output ?
- 23dollars
- 203dollars
- 320dollars
- 23
109. <?php
echo $_SERVER['REMOTE_ADDR'];
?>
echo $_SERVER['REMOTE_ADDR'];
?>
- shows the IP address of the local system
- shows the IP address of the visitor
- shows the IP address of the webserver
- None of the above
110. <?php
$x=dir(".");
while($y=$x->read())
{
echo $y."
"
}
$y->close();
?>
What is the following output?
$x=dir(".");
while($y=$x->read())
{
echo $y."
"
}
$y->close();
?>
What is the following output?
- display all folder names
- display a folder content
- display content of the all drives
- Parse error