PHP Echo/Print
- What will be the output of the following PHP code ?
<?php
$First = "First";
$Second = "Second";
print($First,$Second);
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The above syntax will produce an error, unlike the echo statement.
- What will be the output of the following PHP code ?
<?php
$Color1 = "RED";
$Color2 = "YELLOW";
print("$Color1$Color2");
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
This is same as the echo statement.
- What will be the output of the following PHP code ?
<?php
$Color1 = "YELLOW";
$Color2 = "GREEN";
print($Color1==$Color2);
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Since we are equating two unequal strings we do not get any output.
- What will be the output of the following PHP code ?
<?php
$Country1 = "INDIA";
$Country2 = "INDIA";
print($Country1 == $Country2);
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
Since both the strings are equal the result 1 is printed on the screen.
- What will be the output of the following PHP code ?
<?php
print "Hello Interview Mania!<br>";
print "I'm about to learn PHP!";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
Most of the properties of echo and print are same. Strings can contain HTML markup.