- 如果一个php文件只有php代码,不要写结束符号(因为php解析完自己的,会继续解析后面的,写了结束符号,后面有回车,则产生不必要空行)
- 单双引号区别:单引号内部的变量不会执行,双引号会执行
- 双引号:
$str = 'hello';
echo "the $str"; //the hello
- 单引号:
$str = 'hello';
echo 'the $str'; //the $str
$str = 'hello';
echo "the $str"; //the hello
$str = 'hello';
echo 'the $str'; //the $str