PHP Escape Slash

Using Escape Slash

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

Not Using Escape Slash

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

Explanation

The escape slash allows special characters, such as quotation marks, to be included inside a PHP string without ending the string early. In my first example, I used backslashes before the quotation marks around my name. In the second example, I avoided escape slashes by using single quotes and joining the variable to the string.

Back to Activity 3