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

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

WBOY
WBOYOriginal
2016-06-13 10:50:12853browse

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

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

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

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

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

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

?

Statement:
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