PHP MCQ Question and Answer
PHP MCQ Question and Answer
121. PHP is a _____ . It means you do not have to tell PHP which data type the variable is.PHP automatically converts the variable to the correct data type, depending on its value.
- client side language
- local language
- global language
- loosely typed language
122. Which of the following is not a valid variable name?
- $number-in-class
- $nic
- $NumberInClass
- $number_in_class
123. Which of the following function is used to change the root directory in PHP?
- choot()
- change_root()
- cd_root()
- cd_r()
124. PHP is
- client side script language
- server side script language
- event-driven language
126. <?php
$x=array(4,2,5,1,4,5,3,4);
$y=array_count_values($x);
echo count($y);
?>
$x=array(4,2,5,1,4,5,3,4);
$y=array_count_values($x);
echo count($y);
?>
- 8
- 5
- 7
- 28
128. what will be the output of below code ?
<?php
$arr = array(5 => 1, 12 => 2);
$arr[] = 56;
$arr["x"] = 42;
echo var_dump($arr);
?>
<?php
$arr = array(5 => 1, 12 => 2);
$arr[] = 56;
$arr["x"] = 42;
echo var_dump($arr);
?>
- 42
- array(3) { [12]=> int(2) [13]=> int(56) ["x"]=> int(42) }
- array(4) { [5]=>int(1) [12]=> int(2) [13]=> int(56) ["x"]=> int(42) }
- 1,2,56,42
129. what will the ouptut of below date() function ?
<?php
$date="2009-5-19";
$time="14:31:38";
$datetime=$date.$time;
echo date("Y-m-d:H:i:s",strtotime($datetime));
?>
<?php
$date="2009-5-19";
$time="14:31:38";
$datetime=$date.$time;
echo date("Y-m-d:H:i:s",strtotime($datetime));
?>
- 2009-5-19:14:31:38
- 2009-5-19:2:31:38
- 19-5-2009:2:31:38
- 19/5/2009:14:31:38
130. <?php
$color=array("red","yellow","white");
$x=in_array("black",$color);
if($x==0)
echo "good bye";
if($x==1) echo "Hello";
?>
$color=array("red","yellow","white");
$x=in_array("black",$color);
if($x==0)
echo "good bye";
if($x==1) echo "Hello";
?>
- Hello
- Error
- good bye
- None of the above