Backslash () is used in PHP as escaping character. Escape sequences are started with escaping character backslash ().

List of widely used escape sequences in PHP:

Print the next character as a double quote

Print the next character as a single quote


Print a new line character


Print a tab character


Print a carriage return 


Print the next character as a dollar

Escape Sequence Examples :

Here is a code example of these escape sequences in action:

“This is an “escaped double quote” string”
echoNaman’s photo”
echo “I have $100 in my pocket”
echo “This ends with a line returnn”
echo “c:\Download\myfile.txt”

Output :
This is an “escaped double quote” string;
Naman’s photo
I have $100 in my pocket
This ends with a line return


Leave a Reply

%d bloggers like this: