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

1.单引号里面的字符串直接全部转义,原样输出(即:单引号内部的变量不会被执行)

2.双引号里面的变量会被替换(即:变量会执行)

例如:

$name = 'hello';

echo "the $name";  会输出 the hello

而如果是单引号

$name = 'hello';

echo 'the $name';  会输出 the $name

复杂式:字符串厘面含有特殊字符,单引号,双引号,变量,换行等

$string=<<<string

  jfkd

  "nihao"

  'nihaoa'

string;

注意: $string 为变量名 string为开始标签和结束标签 开始后和结束标签前面不允许有空格

上面会原样输出。