PHP - String Escape Character

Introduction

Here's a list of the more common escape sequences that you can use within double-quoted strings:

Sequence Meaning
\n A line feed character (ASCII 10)
\r A carriage return character (ASCII 13)
\t A horizontal tab character (ASCII 9)
\v A vertical tab character (ASCII 11)
\f A form feed character (ASCII 12)
\\ A backslash (as opposed to the start of an escape sequence)
\$ A $ symbol (as opposed to the start of a variable name)
\" A double quote (as opposed to the double quote marking the end of a string)

Within single-quoted strings, you can actually use a couple of escape sequences.

Use \' to include a literal single quote within a string.

To include the literal characters \' within a single-quoted string, use \\\'.