Escape Sequences in Double-Quoted Strings in PHP

Q

How Many Escape Sequences Are Recognized in Double-Quoted Strings?

✍: FYIcenter.com

A

There are 12 escape sequences you can use in double-quoted strings:

  • \\ - Represents the back slash character.
  • \" - Represents the double quote character.
  • \$ - Represents the dollar sign.
  • \n - Represents the new line character (ASCII code 10).
  • \r - Represents the carriage return character (ASCII code 13).
  • \t - Represents the tab character (ASCII code 9).
  • \{ - Represents the open brace character.
  • \} - Represents the close brace character.
  • \[ - Represents the open bracket character.
  • \] - Represents the close bracket character.
  • \nnn - Represents a character as an octal value.
  • \xnn - Represents a character as a hex value.

 

Understanding PHP String Literals and Operations

⇒⇒PHP Tutorials

2016-10-13, 253👍, 0💬