我剛剛開始學習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