PHP Escape Slash

Without Escape Slash

Alex said 'Hello!'

With Escape Slash

Alex said "Hello!"

Explanation

The escape slash is a backslash used before certain characters in PHP. In the second example, the backslash allows me to put double quotation marks inside a string that already uses double quotation marks. Without the escape slash, PHP could think the string ends too early.

Back to Home