Home > Backend Development > PHP Tutorial > How to output double quotes ' and single quotes '' in php_PHP Tutorial

How to output double quotes ' and single quotes '' in php_PHP Tutorial

WBOY
Release: 2016-07-21 15:37:54
Original
1401 people have browsed it

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 "".

www.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...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template