PHP escape characters have been found in many articles on the internet. as mentioned above, php strings with single quotes as delimiters support two escape types: \, & nbsp; \ '& nbsp; php strings with double quotation marks as delimiters. eight escape characters are supported: \\, & nbsp; \ ", & nbsp; \ r, & nbsp; \ n, & nbsp; \ t, & nbsp ;\$, & nbsp PHP escape characters
I found many articles on the Internet, all of which said:
Php string with single quotes as the delimiter. two escape characters are supported :\\,\'
Php strings with double quotation marks as delimiters. eight escape characters are supported: \, \ ", \ r, \ n, \ t, \ $, \ [0-7] {1, 3}, \ x [0-9A-Fa-f] {1, 2}
However, in practice, this is not the case. single quotation marks and double quotation marks, addshlashes () are all escaped. in the following example, do you think differently?
The test results are as follows:
$ Single_quote_str = '\' double quotation marks in single quotation marks \ 'test .';
$ Double_quote_str = "\" double quotation marks \ "test the 'single quote .";
Single quotation mark test:
Test the "double quotation marks" in the original output string = 'single quota.
Escape string = \ 'single quotes \' \ "double quotation marks \" test.
Test the function of restoring the double quotation marks in the string = 'single quota.
Double quotation mark test:
Test the 'single quota' in the original output string = "double quotation marks.
Escape string = \ "double quotation marks \" \ 'single quotation marks \ 'test.
Test the 'single quota' function in the restored string = "double quotation marks". share it: More
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.