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 = 'php').'variable';
?>
</div>
webmullphp
phpvariable
0variable

Correct!

Wrong!

What is the outcome of this piece of code:
<div class="question_list_op">
<?php
function webmull ($web, $mull)
{
return $web + $mull;
}
$web =1;
$mull =2;

for ($var=0; $var<10; $var++){
echo webmull($web, $mull).',';
?>
</div>
1,2,3,4,5,6,7,8,9
1,2,3,4,5,6,7,8,9,10,
1,2,3,5,8,13,21,34,55,89
3,3,3,3,3,3,3,3,3,3,

Correct!

Wrong!

What is the outcome of this piece of code:
<div class="question_list_op">
<?php
define('CONSTANT', 1);
define('_CONSTANT', 0);

define('EMPTY', '');

if (!empty(EMPTY)){
if(!((boolean) _CONSTANT)){
print "One";
}
}else if(constant('CONSTANT')){
print "Two";
}
?>
</div>
One
Two
Syntax Error

Correct!

Wrong!

What will be the values of $a and $b after the code below is executed?
<div class="question_list_op">
<?php
$web = '2';
$mull = &$web;
$mull = "1$mull";
echo $web." ";<
echo $mull;
?>
</div>
21$mull
21 21
12 12
12$mull

Correct!

Wrong!

What will be the output of each of the statements below?
<div class="question_list_op">
<?php
var_dump(0567 == 567);
var_dump('0567' == 567);
var_dump('0567' === 567);
?>
</div>
bool(false) bool(true) bool(false)
bool(true) bool(true) bool(false)
bool(false) bool(false) bool(false)
bool(true) bool(true) bool(true)

Correct!

Wrong!

What output would you think of following php code?
<div class="question_list_op">
<?php
for ($web = 0; $web < 20; $web++)
$mull += 0.9; print "$mull\n";
if ($mull == 1.0) print "Equals"; else print "Not Equals";
?>
</div>
0.9 Not Equals
18 Equals
18 Not Equals
1.0 Not Equals
None of the above

Correct!

Wrong!

Output of following code will be?
<div class="question_list_op">
<?php
$phparr = "a";
$phparr[0] = "b";
echo $phparr;
echo $phparr[0];
?>
</div>
bb
Parse
ab
$arr is undefined
error

Correct!

Wrong!

What will be the output of the following code?
<div class="question_list_op">
<?php var_dump (3*4); ?>
</div>
3*4
12
int(3*4)
int(12)
None of the above

Correct!

Wrong!

Output of following code will be?
<div class="question_list_op">
<?php
$php_var = 2 + "-1.4e3";
echo $php_var;
?>
</div>
2
2-1.4e3
-1398
Error:cannot add integer and string
None of the above

Correct!

Wrong!

Output of the below PHP code?
<div class="question_list_op">
<?php
$web = 4;
$mull = 5;
echo (int) $web / (int) $mull
?>
</div>
4
5
1
0.8
Error

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

PHP Basics Quiz questions for Variables, Constant and data type

I got %%score%% of %%total%% right

%%description%%

%%description%%

Loading...