Output of following code will be?
<div class="question_list_op">
<?php
$phpvar1 = "a";
$$phpvar1 = "b";
echo "$phpvar1 $a";
?>
</div>
<div class="question_list_op">
<?php
$phpvar1 = "a";
$$phpvar1 = "b";
echo "$phpvar1 $a";
?>
</div>
Error: Parse error in line 2 ($$var1 = "b")
a b
Error: $a is undefined
$var1 $a
Correct!
Wrong!
What is the output ?
<div class="question_list_op">
<?php
define("webmull","10");
$webmull=webmull+5;
echo webmull;
?>
</div>
<div class="question_list_op">
<?php
define("webmull","10");
$webmull=webmull+5;
echo webmull;
?>
</div>
10
5
Error
15
Correct!
Wrong!
What is the output?
<div class="question_list_op">
<?php
$web="mull";
$mull="PHP";
echo $$web;
?>
</div>
<div class="question_list_op">
<?php
$web="mull";
$mull="PHP";
echo $$web;
?>
</div>
PHP
mull
mullPHP
error
Correct!
Wrong!
What will be printed?
<div class="question_list_op">
<?php
$php_var = 'web';
$php_VAR = 'mull';
echo "$php_var$php_VAR";
?>
</div>
<div class="question_list_op">
<?php
$php_var = 'web';
$php_VAR = 'mull';
echo "$php_var$php_VAR";
?>
</div>
webweb
mullmull
webmull
mullweb
Correct!
Wrong!
What is the outcome of this piece of code:
<div class="question_list_op">
<?php
function webmull() {
static $php_count = 0;
$php_count++;
echo $php_count;
if ($php_count < 10) {
webmull();
} $php_count--;
}
webmull();
?>
</div>
<div class="question_list_op">
<?php
function webmull() {
static $php_count = 0;
$php_count++;
echo $php_count;
if ($php_count < 10) {
webmull();
} $php_count--;
}
webmull();
?>
</div>
123456789109
12345678910
123456789
infinite loop
Correct!
Wrong!
What is the output?
<div class="question_list_op">
<?php
$php_var = 'webmull';
echo " the letter $php_var ";
echo ' the letter $php_var ';
?>
</div>
<div class="question_list_op">
<?php
$php_var = 'webmull';
echo " the letter $php_var ";
echo ' the letter $php_var ';
?>
</div>
the letter $php_var the letter webmull
the letter webmull the letter $php_var
the letter webmull the letter webmull
the letter the letter $php_var
Correct!
Wrong!
What is the outcome of this piece of code?
<div class="question_list_op">
<?php
$webmull = "0";
if (empty($webmull)) {
echo "empty";
} else {
echo "not empty";
}
?>
</div>
<div class="question_list_op">
<?php
$webmull = "0";
if (empty($webmull)) {
echo "empty";
} else {
echo "not empty";
}
?>
</div>
empty
A fatal error is generated
the letter webmull the letter webmull
Correct!
Wrong!
What is the output of the following code?
<div class="question_list_op">
<?php
$web = "mull";
$mull = "web";
echo $$$web;
?>
</div>
<div class="question_list_op">
<?php
$web = "mull";
$mull = "web";
echo $$$web;
?>
</div>
web
mull
an empty string
an error
Correct!
Wrong!
What is the output of the following script?
<div class="question_list_op">
<?php
function webmull (&$w = 0, &$m = 1)
{
$php_result = $w + $m;
$w = $m;
$m = $php_result;
return $php_result;
}
for ($i = 0; $i < 10; $i++) {
echo webmull() . ',';
}
?>
</div>
<div class="question_list_op">
<?php
function webmull (&$w = 0, &$m = 1)
{
$php_result = $w + $m;
$w = $m;
$m = $php_result;
return $php_result;
}
for ($i = 0; $i < 10; $i++) {
echo webmull() . ',';
}
?>
</div>
An error
1,1,1,1,1,1,1,1,1,1,
1,1,2,3,5,8,13,21,34,55,
Nothing
Correct!
Wrong!
What is the output of the following code?
<div class="question_list_op">
<?php
$web = 'web';
$mull = 'mull';
echo isset($webmull) ? $web.$mull.$webmull : ($webmull = 'webmull').'php';
?>
</div>
<div class="question_list_op">
<?php
$web = 'web';
$mull = 'mull';
echo isset($webmull) ? $web.$mull.$webmull : ($webmull = 'webmull').'php';
?>
</div>
webphp
webmullphp
0php
Correct!
Wrong!
Share the quiz to show your results !
Subscribe to see your results
PHP Basics Quiz questions for Variables and Constant
I got %%score%% of %%total%% right
%%description%%
%%description%%
Loading...