What is the outcome of this piece of code?
<?php
$webmull = "0";
if (empty($webmull)) {
echo "empty";
} else {
echo "not empty";
}
?>
$webmull = "0";
if (empty($webmull)) {
echo "empty";
} else {
echo "not empty";
}
?>
Correct!
Wrong!
-
What is the output?
<?php
define("PHP", "php");
define("WEBMUL", "1");
function webmull() {
echo PHP;
echo WEBMULL;
}
ECHO "=>";
echo webmull();
?>
define("PHP", "php");
define("WEBMUL", "1");
function webmull() {
echo PHP;
echo WEBMULL;
}
ECHO "=>";
echo webmull();
?>
Correct!
Wrong!
-
What is the outcome of this piece of code:
<?php
var_dump(is_real(10.00));
var_dump(is_scalar(array('web', 'mull')));
?>
var_dump(is_real(10.00));
var_dump(is_scalar(array('web', 'mull')));
?>
Correct!
Wrong!
-
What is the outcome of this piece of code:
<?php
$W = 50;
$E = '50';
$B = true;
$M = 'php';
echo ( $W == $E ) ? " equal " : " not equal ";
echo ( $B == $M ) ? " equal " : " not equal ";
echo ( $B === "php") ? " equal " : " not equal ";
?>
$W = 50;
$E = '50';
$B = true;
$M = 'php';
echo ( $W == $E ) ? " equal " : " not equal ";
echo ( $B == $M ) ? " equal " : " not equal ";
echo ( $B === "php") ? " equal " : " not equal ";
?>
Correct!
Wrong!
-
What is the outcome of this piece of code:
<?php
var_dump(is_int(11));
var_dump(is_int("11"));
var_dump(is_int(11.7));
var_dump(is_int(true));
?>
var_dump(is_int(11));
var_dump(is_int("11"));
var_dump(is_int(11.7));
var_dump(is_int(true));
?>
Correct!
Wrong!
-
What is the outcome of this piece of code:
<?php
echo (string) 7;
echo (string) 7.5;
echo (string) array('5','2');
echo (float) 'webmull';
?>
echo (string) 7;
echo (string) 7.5;
echo (string) array('5','2');
echo (float) 'webmull';
?>
Correct!
Wrong!
-
What will be the value of $webmull after this code executes? Explain your answer.
<?php
$webmull = NULL;
if ('0xFF' == 255) {
$webmull = (int)'0xFF';
}
echo $webmull;
?>
$webmull = NULL;
if ('0xFF' == 255) {
$webmull = (int)'0xFF';
}
echo $webmull;
?>
Correct!
Wrong!
-
What Ouput of the following code will be?
<?php
for ($i = 0; $i < 5; ++$i)
{
if ($i ==2);
continue;
print "$i\n";
}
?>
for ($i = 0; $i < 5; ++$i)
{
if ($i ==2);
continue;
print "$i\n";
}
?>
Correct!
Wrong!
-
What will be displayed in a browser when the following PHP code is executed:
<?php
$php_variable = 1;
switch ($php_variable) {
case 1:
echo "Hello Webmull";
default:
echo "Webmull PHP";
break;
}
?>
$php_variable = 1;
switch ($php_variable) {
case 1:
echo "Hello Webmull";
default:
echo "Webmull PHP";
break;
}
?>
Correct!
Wrong!
-
What will be displayed in a browser when the following PHP code is executed:
<?php
for ($webmull = 15; $webmull != 10; $webmull--){
echo "Hello ";
}
?>
for ($webmull = 15; $webmull != 10; $webmull--){
echo "Hello ";
}
?>
Correct!
Wrong!
-

PHP Basics Quiz questions for data type and Control Structures
I got %%score%% of %%total%% right