1.

Which statement will output $x on the screen?(a) echo “\$x”;(b) echo “$$x”;(c) echo “/$x”;(d) echo “$x;”;The question was asked in an online interview.This intriguing question comes from Basics in division Basics of PHP of PHP

Answer»

Correct answer is (a) echo “\$x”;

The best I can explain: 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.



Discussion

No Comment Found