PHP Operators
- What will be the output of the following PHP code ?
<?php
$n = 9;
while (++$n)
{
while (--$n > 0)
print $n;
}
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The loop never ends as n is always incremented and then decremented.
- What will be the output of the following PHP code ?
<?php
echo 7 * 5 / 4 + 10;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Operator precedence order must be followed.
- What will be the output of the following PHP code ?
<?php
echo 10 * 15 / 12 + 14
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Operator precedence order must be followed.
- What will be the output of the following PHP code ?
<?php
$n = 10;
$m = 10;
if ($n && ($m = $n + 10)) {
echo "True";
}
echo $m;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
In if condition when the first case is 10 and is an && operation then the second command is executed.
- What will be the output of the following PHP code ?
<?php
$p = 20;
$q = 10;
if ($p || ($q = $p + 10)) {
echo "True";
}
echo $q;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
In if condition when the first case is 1 and is an || operation then the second command is not executed.