PHP Introduction
- What will be the output of the following php code?
<?php
$n = "12";
$n1 = "21";
print $n+$n1;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The numbers inside the double quotes are considered as integers and not string, therefore the value 33 is printed and not 12+21.
- What will be the output of the following php code?
<?php
$n = 10;
$n1 = 12;
print $n . "+". $n1;
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
.(dot) is used to combine two parts of the statement. Example ( $n. “Hello World” ) will output 10Hello World.
- Which of the following php statement/statements will store 120 in variable n?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
You need not specify the datatype in php.
- PHP files have a default file extension of_______
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
.php
- A PHP script should start with ___ and end with ___
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Every section of PHP code starts and ends by turning on and off PHP tags to let the server know that it needs to execute the PHP in between them.