In PHP programming, double quotes " and single quotes ' are expressions of strings and characters. So how do we output it? Let's take a look at a simple example of outputting single and double quotes.
On the homepage, let’s look at several methods of outputting double quotes
Method 1.
Copy the code The code is as follows:
$ str ='I want to output double quotes"';
echo $str;
The result is: I want to output double quotes"
Method 2
Copy code The code is as follows:
$str ="Output double quotes"";
echo $str;
//Result output Double quotes"
Output single quotes and double quotes
Copy code The code is as follows:
$str ="Output single quotes'";
$str1='Output single quotes'';
echo $str;
?>
Literal variables between single quotes will not be executed, but variables between double quotes can be executed, so when there are no variables, using single quotes to output characters is much more efficient than using double quotes
.
For special characters, you can use the transfer character "".
http://www.bkjia.com/PHPjc/321819.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321819.htmlTechArticleIn PHP programming, double quotes " and single quotes ' are string and character expressions, so we need to output them How to do it? Let’s look at a simple example of outputting single and double quotes...