PHP单引号和双引号的区别

版权声明:转载请注明出处http://blog.csdn.net/xuaho0907 https://blog.csdn.net/xuaho0907/article/details/82529639

先定义一个测试用的变量:

$name = 'hello';

双引号里面引用的变量可以输出变量的值,例如:
echo "the $name";

会输出 the hello

单引号里面写什么就输出什么,不会引用变量的值,例如:
echo 'the $name';

会输出 the $name

猜你喜欢

转载自blog.csdn.net/xuaho0907/article/details/82529639
今日推荐