PHP Escape Slash

Using Escape Slash

He said, "Hello Alex" to the class.

Not Using Escape Slash

He said, "Hello Alex" to the class.

Explanation

The escape slash is a backslash placed before a special character. In the first example, backslashes allow double quotation marks to appear inside a double-quoted PHP string without ending the string early. In the second example, single quotes and concatenation make the extra backslashes unnecessary.

Back to Activity 3