PHP Operators
- What will be the output of the following PHP code ?
<?php
$v = 'Mania';
echo "Inter$view";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Inter, because $v became $view, which is undefined.
- What will be the output of the following PHP code ?
<?php
$str = 'view';
echo 'Inter{$str}Mania';
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Inter{$str}Mania, single quotes are not parsed.
- What will be the output of the following PHP code ?
<?php
$str = 'view';
print "Inter".$str."Mania";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
dereferences the variable/string within.
- What will be the output of the following PHP code ?
<?php
$str = 'view ';
print "Inter{$str}Mania";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
{$}dereferences the variable within.
- What will be the output of the following PHP code ?
<?php
$num = '8' ;
print + + $num;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The character is type casted to integer before multiplying.