PHP 中的 echo 单引号和双引号
Possible Duplicate:
Difference between single quote and double quote string in php
Hi,
What is the difference between echo 'Test Data';
and echo "Test Data";
in PHP.
Both statements give me same output.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信双引号允许变量被值替换:
显示:
显示:
I believe that double quotes allow variables to be replaced by the value :
displays :
displays :
单引号字符串不会有由解释器扩展的变量或转义序列,而双引号字符串将 - 查看以下不同的输出:
因此单引号字符串稍微“更好”使用,因为解释器不必这样做检查字符串的内容以获取变量引用。
Single-quoted strings will not have variables or escape sequences expanded by the interpreter, whereas double-quoted strings will - look at the different output of:
Single-quoted strings are hence marginally 'better' to use as the interpreter won't have to check the contents of the string for a variable reference.