PHP Escape Slash

Example Using Escape Slash

My name is "Anushka" and I am learning PHP.

Example Without Escape Slash

My name is "Anushka" and I am learning PHP.

Explanation

The escape slash, also called a backslash, allows special characters such as quotation marks to be included inside a PHP string. In the first example, the backslash tells PHP that the quotation marks around my name are part of the text. Without the escape slash, I used single quotes and concatenation to display the quotation marks correctly.

Back to Activity 3 Home