In php programming, double quotation marks "and single quotation marks" are strings and characters. How can we output them? Let's look at a simple example of single double quotation marks output.
On the homepage, let's look at several methods for outputting double quotation marks.
Method 1.
Copy codeThe Code is as follows:
$ Str = 'I want to output double quotation marks "';
Echo $ str;
The result is: I want to output double quotation marks"
Method 2
Copy codeThe Code is as follows:
$ Str = "output double quotation marks \"";
Echo $ str;
// Output double quotation marks"
Output single quotes and double quotes
Copy codeThe Code is as follows:
<? Php
$ Str = "output single quotes '";
$ Str1 = 'output single quotes \'';
Echo $ str;
?>
Variables in the literal in the middle of a single quotation mark are not executed, and variables in the middle of a double quotation mark can be executed. Therefore, the efficiency of output characters in single quotation marks is much higher than that in double quotation marks without variables.
For special characters, you can use the Escape Character.