Usage analysis of PHP double quotes and single quotes
In this article, I have encountered a problem of double quotation marks and single quotation marks in php in my actual work, with a solution attached. if you have any need, you can make a reference. Use PHP to filter line breaks in a string. this operation is usually performed as follows:
PHP provides three methods for defining strings: single quotes, double quotation marks, and local documents (here document or heredoc ). Single quotes: using single quotes is the most efficient method, because PHP does not check the built-in variables and escape sequences in single quotes. only the backslash and single quotes must be escaped. Double quotation marks: the built-in variables and escape sequences are checked, but the escape single quotation marks cannot be recognized. This also shows the error of the code. the correct method is to use double quotation marks to define the escape sequence of line breaks:
Check all built-in variables and escape sequences. double quotation marks do not need to be escaped. For example:
|