What is the output of the following code?
<?php
$web = 'web';
$mull = 'mull';
echo isset($webmull) ? $web.$mull.$webmull : ($webmull = 'php').'variable';
?>
$web = 'web';
$mull = 'mull';
echo isset($webmull) ? $web.$mull.$webmull : ($webmull = 'php').'variable';
?>
Correct!
Wrong!
-
What is the outcome of this piece of code:
<?php
function webmull ($web, $mull)
{
return $web + $mull;
}
$web =1;
$mull =2;
for ($var=0; $var<10; $var++){
echo webmull($web, $mull).',';
}
?>
function webmull ($web, $mull)
{
return $web + $mull;
}
$web =1;
$mull =2;
for ($var=0; $var<10; $var++){
echo webmull($web, $mull).',';
}
?>
Correct!
Wrong!
-
What is the outcome of this piece of code:
<?php
define('CONSTANT', 1);
define('_CONSTANT', 0);
define('EMPTY', '');
if (!empty(EMPTY)){
if(!((boolean) _CONSTANT)){
print "One";
}
}else if(constant('CONSTANT')){
print "Two";
}
?>
define('CONSTANT', 1);
define('_CONSTANT', 0);
define('EMPTY', '');
if (!empty(EMPTY)){
if(!((boolean) _CONSTANT)){
print "One";
}
}else if(constant('CONSTANT')){
print "Two";
}
?>
Correct!
Wrong!
-
What will be the values of $a and $b after the code below is executed?
<?php
$web = '2';
$mull = &$web;
$mull = "1$mull";
echo $web." ";
echo $mull;
?>
$web = '2';
$mull = &$web;
$mull = "1$mull";
echo $web." ";
echo $mull;
?>
Correct!
Wrong!
-
What will be the output of each of the statements below?
<?php
var_dump(0567 == 567);
var_dump('0567' == 567);
var_dump('0567' === 567);
?>
var_dump(0567 == 567);
var_dump('0567' == 567);
var_dump('0567' === 567);
?>
Correct!
Wrong!
-
What output would you think of following php code?
<?php
for ($web = 0; $web < 20; $web++)
$mull += 0.9; print "$mull\n";
if ($mull == 1.0) print "Equals"; else print "Not Equals";
?>
for ($web = 0; $web < 20; $web++)
$mull += 0.9; print "$mull\n";
if ($mull == 1.0) print "Equals"; else print "Not Equals";
?>
Correct!
Wrong!
-
Output of following code will be?
<?php
$phparr = "a";
$phparr[0] = "b";
echo $phparr;
echo $phparr[0];
?>
$phparr = "a";
$phparr[0] = "b";
echo $phparr;
echo $phparr[0];
?>
Correct!
Wrong!
-
What will be the output of the following code?
<?php var_dump (3*4); ?>
Correct!
Wrong!
-
Output of following code will be?
<?php
$php_var = 2 + "-1.4e3";
echo $php_var;
?>
$php_var = 2 + "-1.4e3";
echo $php_var;
?>
Correct!
Wrong!
-
Output of the below PHP code?
<?php
$web = 4;
$mull = 5;
echo (int) $web / (int) $mull
?>
$web = 4;
$mull = 5;
echo (int) $web / (int) $mull
?>
Correct!
Wrong!
-

PHP Basics Quiz questions for Variables, Constant and data type
I got %%score%% of %%total%% right