Output of following code will be?
<?php
$phpvar1 = "a";
$$phpvar1 = "b";
echo "$phpvar1 $a";
?>
$phpvar1 = "a";
$$phpvar1 = "b";
echo "$phpvar1 $a";
?>
Correct!
Wrong!
-
What is the output ?
<?php
define("webmull","10");
$webmull=webmull+5;
echo webmull;
?>
define("webmull","10");
$webmull=webmull+5;
echo webmull;
?>
Correct!
Wrong!
-
What is the output?
<?php
$web="mull";
$mull="PHP";
echo $$web;
?>
$web="mull";
$mull="PHP";
echo $$web;
?>
Correct!
Wrong!
-
What will be printed?
<?php
$php_var = 'web';
$php_VAR = 'mull';
echo "$php_var$php_VAR";
?>
$php_var = 'web';
$php_VAR = 'mull';
echo "$php_var$php_VAR";
?>
Correct!
Wrong!
-
What is the outcome of this piece of code:
<?php
function webmull() {
static $php_count = 0;
$php_count++;
echo $php_count;
if ($php_count < 10) {
webmull();
} $php_count--;
}
webmull();
?>
function webmull() {
static $php_count = 0;
$php_count++;
echo $php_count;
if ($php_count < 10) {
webmull();
} $php_count--;
}
webmull();
?>
Correct!
Wrong!
-
What is the output?
<?php
$php_var = 'webmull';
echo " the letter $php_var ";
echo ' the letter $php_var ';
?>
$php_var = 'webmull';
echo " the letter $php_var ";
echo ' the letter $php_var ';
?>
Correct!
Wrong!
-
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 of the following code?
<?php
$web = "mull";
$mull = "web";
echo $$$web;
?>
$web = "mull";
$mull = "web";
echo $$$web;
?>
Correct!
Wrong!
-
What is the output of the following script?
<?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() . ',';
}
?>
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() . ',';
}
?>
Correct!
Wrong!
-
What is the output of the following code?
<?php
$web = 'web';
$mull = 'mull';
echo isset($webmull) ? $web.$mull.$webmull : ($webmull = 'webmull').'php';
?>
$web = 'web';
$mull = 'mull';
echo isset($webmull) ? $web.$mull.$webmull : ($webmull = 'webmull').'php';
?>
Correct!
Wrong!
-

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