Conditional Statements
1.
What will be the output of the following PHP code?
<?php
$x;
if ($x)
print "hi" ;
else
print "how are u";
?>
2.
What will be the output of the following PHP code?
<?php
$x = 0;
if ($x++)
print "hi";
else
print "how are u";
?>
3.
What will be the output of the following PHP code?
<?php
$x;
if ($x == 0)
print "hi" ;
else
print "how are u";
print "hello"
?>
4.
What will be the output of the following PHP code?
<?php
$x = 0;
if ($x == 1)
if ($x >= 0)
print "true";
else
print "false";
?>
5.
What will be the output of the following PHP code?
<?php
$a = 1;
if ($a--)
print "True";
if ($a++)
print "False";
?>
6.
What will be the output of the following PHP code?
<?php
$a = 1;
if (echo $a)
print "True";
else
print "False";
?>
7.
What will be the output of the following PHP code?
<?php
$a = 1;
if (print $a)
print "True";
else
print "False";
?>
8.
What will be the output of the following PHP code?
<?php
$a = 10;
if (1)
print "all";
else
print "some"
else
print "none";
?>
9.
What will be the output of the following PHP code?
<?php
$a = 10;
if (0)
print "all";
if
else
print "some"
?>
10.
What will be the output of the following PHP code?
<?php
$a = "";
if ($a)
print "all";
if
else
print "some";
?>