PHP MCQ Questions and Answers
Practice ModeShowing 10 of 130 questions
Q121
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.
Answer: Option D
Q122
Which of the following is not a valid variable name?
Answer: Option A
Q123
Which of the following function is used to change the root directory in PHP?
Answer: Option A
Q124
PHP is
Answer: Option B
Q125
$father="mother";
$mother="son";
echo $$father;
?>
Answer: Option A
Q126
<?php
$x=array(4,2,5,1,4,5,3,4);
$y=array_count_values($x);
echo count($y);
?>
Answer: Option B
Q127
The PHP syntax is most similar to:
Answer: Option A
Q128
what will be the output of below code ?
<?php
$arr = array(5 => 1, 12 => 2);
$arr[] = 56;
$arr["x"] = 42;
echo var_dump($arr);
?>
Answer: Option C
Q129
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));
?>
Answer: Option A
Q130
<?php
$color=array("red","yellow","white");
$x=in_array("black",$color);
if($x==0)
echo "good bye";
if($x==1) echo "Hello";
?>
Answer: Option C