Escape slashes in PHP help to interepret variables and special characters in single or double quotations.

Double quotations will evaulate included variables, while single quotations will interpret the whole string literally.

Below, the examples show a message where the $date variable is included at the end of the string.

The first uses double quotations, and $date is interpreted to be the value "December 31st, 1969."

The second uses single quotations, and $date is printed as $date.

The third example shows adding the escape slash (\) in the double quotations causes the $ to be interpreted literally, causing the page to display $date.

The fourth example shows that doing the same causes the added slash to be printed, as the single quotations still interprets it literally.

**NOTE** The escape slash is needed for the apostraphe in Today's when using single quotations so the script doesn't terminate the string prematurely.


(Double Quotations) Today's date is December 31st, 1969

(Single Quotations) Today's date is $date

(Double Quotations, escaped dollar sign) Today's date is $date

(Single Quotations) Today's date is \$date