PHP Escape Slash

Example Using the Escape Slash

He said, "Hello, my name is Nick."

Example NOT Using the Escape Slash

Hello, my name is Nick.

explanation

The escape slash lets PHP treat a special character as part of the text instead of interpreting it as the end of a string or another instruction. In this example, the backslashes allow quotation marks to appear inside a string that is already surrounded by double quotes. Without escaping the quotation marks, PHP would think the string ended early.