PHP If Else/Else If Statement
- What will be the output of the following PHP code ?
<?php
$p = 22;
if ($p-- - --$p - $p)
print "Interview";
else
print "Mania";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Computing the expression in the if clause,it sums upto to 2 which is a positive value.
- What will be the output of the following PHP code ?
<?php
$str = "Inter";
if ($str.length)
print $str.view;
else
print "Mania";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The . operator appends a string and returns true.
- What will be the output of the following PHP code ?
<?php
$s = "hey";
if (strlen($s))
print strlen($s);
else
print "nice";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The function strlen($s) gives the length of the string,5, which is considered true.