PHP Introduction
- Who is the father of PHP?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Rasmus Lerdorf
- What will be the output of the following PHP code?
<?php
$math = "25 students";
$Science = 35;
$math = $math + $Science;
echo "$math";
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The integer value at the beginning of the original $math string is used in the calculation. However if it begins with anything but a numerical value, the value will be 0.
- Which of the below statements is equivalent to $sum+= $sum ?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
a += b is an addition assignment whose outcome is a = a + b. Same can be done with subtraction,multiplication,division etc.
- Which statement will output $x on the screen?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
A backslash is used so that the dollar sign is treated as a normal string character rather than prompt PHP to treat $x as a variable. The backslash used in this manner is known as escape character.
- What will be the output of the following code?
<?php
function track()
{
static $var = 0;
$var++;
echo $var;
}
track();
track();
track();
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Because $count is static, it retains its previous value each time the function is executed.