 <p>The backslash <code>\</code> is used in "string context" to escape some characters to either have the same character inside the string which the string is encapsulated with, or to insert some special character, like a new-line <code>\n</code>.</p> <p>There is a difference between "embedded code" and "regular expressions":</p> <ul> <li>the source-code you provided is PHP code embedded in HTML</li> <li>regular expressions ("regex") implies some logic that can be defined in a string like this: <code>^[a-zA-Z0-9_]{1,}$</code> and the "special characters" inside it can also be "escaped" with the backslash, including the backslash itself - (with another backslash) - same as "normal" strings.</li> </ul> <p>You can escape your quotes the way you did - as the first example (a), but that makes your code more complex. You can simply use the double, or single quotes as needed like this:</p> <ul> <li>"Monica's attractive... car"</li> <li>'Sandy says: "Hi!"'</li> </ul> <p>Remember to use "curly braces" <code>{ }</code> when embedding variables inside a double-quoted string context like this:</p> <pre><code>$foo = 'bar'; echo "I like Cadbury's lunch-{$foo}"; </code></pre> <p><br></p> <h2>Edit</h2> <p>As pointed out in the comments:</p> <p>The "curly braces" reference is just good practice as it prevents nasty surprises when using variables directly before some alpha-numeric characters, which if left out you may get an "E_NOTICE" error, or you will have to resort to concatenation.</p>