PHP Echo/Print
- What will be the output of the following PHP code ?
<?php
print("This"."is"."a"."good"."girl");
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
You can use the dot operator like in echo but you can not use the comma operator to do the same.
- What will be the output of the following PHP code ?
<?php
print "echo Interview Mania";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The print statement will print whatever is present inside the double-quotes.
- What will be the output of the following PHP code ?
<?php
$num = 5;
print($num);
print $num;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
Print can be used with or without parentheses.
- What will be the output of the following PHP code ?
<?php
$City = array("Chennai", "Mumbai", "Noida");
print $City[2];
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Print statement can be used to output a specific array member.
- What will be the output of the following PHP code ?
<?php
$First = "Ajit";
$Second = "Ats";
print($First $Second);
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
The above syntax will produce an error, unlike the echo statement.