PHP Variables
- What will be the output of the following PHP code ?
<?php
$Fiv-e = 5;
$Si-x = 6;
$Seve-n = 7;
$Eigh-t = 8;
echo "$Fiv-e / $Si-x + $Seve-n / $Eigh-t";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
You can't use - in a variable name.
- What will be the output of the following PHP code ?
<?php
$9nine = 9;
$8eight = 8;
$6six = 6;
echo $9nine + $8eight / $6six - 3;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
A variable name can not start with a numeric value.
- What will be the output of the following PHP code ?
<?php
var $five = 5;
var $six = 6;
echo $five / $six * $five / $six * $six;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
You can not use var before a variable name.
- What will be the output of the following PHP code ?
<?php
int $five = 5;
echo "$five";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Unlike other programming languages there are no data types in PHP.
- What will be the output of the following PHP code ?
<?php
$r = 8;
$s = -6;
$t = 22;
echo 8 + $s * $t / $r;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
First the * is evaluated then / followed by + therefore we can rewrite this expression as 8 +((- 6 * 22) / 8) which results in -8.5.