PHP Escape Slash

Using an Escape Slash

Lojain said, "PHP is interesting to learn."

Not Using an Escape Slash

$name said, "PHP is interesting to learn."

Explanation

The PHP escape slash, or backslash, allows special characters such as quotation marks to appear inside a string without ending the string. In the first example, the backslashes allow double quotation marks to appear inside a double-quoted string. The second example uses single quotes around the string, so the double quotation marks do not need to be escaped.