PHP Syntax
- What will be the output of the following PHP code ?
<?php
$Country1 = "INDIA";
$Country2 = "1";
$Country3 = "USA";
echo "$Country1" + "$Country2" . "$Country3";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
+ gives the value 1 and . is used to give join 1 and USA.
- What will be the output of the following PHP code ?
/*
echo "Hello Interview Mania";
*/
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
/* */ is used for commenting multiple lines.
- What will be the output of the following PHP code ?
<?php
$Country= India;
echo "$Country" . India;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Use of undefined constant India.
- What will be the output of the following PHP code ?
<?php
$Name = "Rahul";
$Name = "Ajit";
echo "$Name";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The variable contains the last value which has been assigned.
- What will be the output of the following PHP code ?
<?php
$name1= Ajit;
$name2= Rahul;
echo "$name1"."$name2";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
It has to be $name1= “Ajit”; and $name2= “Rahul”; therefore the error.