PHP Escape Slash

Using an Escape Slash

He said, "Hello Isaac!"

Not Using an Escape Slash

He said, "Hello Isaac!"

Explanation

The escape slash (aka backslash) tells PHP to treat a special character as apart of the text rather than treating it as PHP syntax. In the first example, the backslashes allow double quotation marks to appear inside an already double quoted string WITHOUT ending the string early. The second example avoids escape slashes by using single quotes.

Back to Start