first of all, what is an escape character?
The escape character, in fact, is the specified PHP syntax with "\" to output. However, the syntax of the rules in different systems to transfer the role of the character is different, for example: in the Windows System carriage return line character with "\ r" or "\ n", and in the Linux system, the two line breaks have a relatively large difference: "\ r" cursor back to the beginning, but still in the bank; "\ n" means the next line and does not go back to the beginning.
the escape characters in PHP are some of the following:
"\ n" ==> line break
"\ r" ==> carriage return
"\ t" ==> horizontal tab
"\ \" ==> backslash
"\$" ==> dollar sign
"\ '" ==> single quotation mark
"\" "==> double quotes
"\[0-7]{1,3}" regular expression matches the character represented by an octal symbol
"\x[0-9a-fa-f]{1,2}" regular expression matches the character represented by a hexadecimal symbol
In PHP, you can use the Echo () and print () statements to send data to a Web browser, or you can use them to send HTML code to a Web browser. Technically, Echo () and print () are language constructs, not functions, where a pair of parentheses is used to help separate the variables and other parts of PHP. The two statements are inherently no different, so using that one does not create any problems. It's a personal habit. They do not differentiate between size words.
The string can be defined using single quotation marks ('), double quotation marks ("), and a delimiter (<<<) 3 methods. The best way to specify a string is to wrap it up in single quotation marks ('). When using strings, it is likely that there are several characters in the string that are confused with PHP scripts, so you need to escape these characters by using the escape character "\"before these characters.
"\" is an escape character, and the first characters immediately after "\" become meaningless. such as "'" is the delimiter of the string, written as "\ " when it loses the meaning of the delimiter, into the ordinary single quotation mark "'" . Friends can output a single quote "'"via echo ' \ ', but the escape character "\" will not be displayed.
When you use these characters in double quotes, they have a special meaning
Escape character Codes |
Meaning of escape character |
\ " |
Double quotes |
\ ' |
Single quotation marks |
\ \ |
Back slash |
\ n |
Line break |
\ r |
Carriage return character |
\ t |
Tabs |
\ $ |
Dollar sign |
Description: If you want to represent single quotation marks in a string, you need to escape by using a backslash (\). For example, to represent the string "I am", you need to write this style "I\ ' am".
Use the transfer character "\" to escape the instance of the string:
<?php echo ' This url_name = \ ' topic.alibabacloud.com\ ';? >
The output is:
This url_name = ' topic.alibabacloud.com '