Home > Backend Development > PHP Tutorial > php中双引号跟单引号的区别

php中双引号跟单引号的区别

WBOY
Release: 2016-06-13 13:11:50
Original
850 people have browsed it

php中双引号和单引号的区别

" "双引号里面的字段会经过编译器解释,然后再当作HTML代码输出。

' '单引号里面的不进行解释,直接输出。

单引号解析的时间比双引号快

单引号支持\转义符,双引号支持的转义符更多

$hello= 3;
echo "hello is $hello"; // 打印结果:hello is 3
echo 'hello is $hello'; // 打印结果: hello is $hello
echo "hello is $hello\n"; // 打印结果: hello is 2 (同时换行)
echo 'hello is $hello\n'; // 打印结果: hello is $hello\n 
Copy after login
?

?

Related labels:
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