我刚刚开始学习PHP,我在网上使用PHP:Visual Quickstart Guide第4版,我有一个关于我在书中学到的脚本的问题,只是写道。PHP中单引号和双引号字符串有什么区别?
这是脚本的代码:
print '<p>Thank you, ' .$title.$name. ' for your comments.</p>
<p>You stated that you found this example to be "'.$response.'" and added:<br />'
.$comments.'</p>';
print "<p>Thank you, $title $name for your comments.</p><p>You stated that you found this example to be '$response' and added:<br/>$comments</p>";
这个脚本是刚刚从通过POST拉HTML表单中显示的一些数据。
这样做的正确方法是什么?在这种情况下,我很难理解'
vs "
。
第二个例子是本书的一个例子,第一个例子是我在试图理解“vs”问题后发现该怎么做的。关于这个问题,在哪里找到一个好的位置'
VS "
。
*(参考)* http://www.php.net/manual/en/language.types.string.php – Gordon