Vidyalelo
PHP · Q17

Basic PHP

Programming · PHP · question 17

Q17

Which statement will output x on the screen?

A.
echo “\$x”;
Answer
B.
echo “$$x”;
C.
echo “/$x”;
D.
echo “$x;”;

Answer: Option A

Solution

Answer: Option A
Solution:
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.