php中的单引号和双引号
如果是一个单纯的字符串,用单引号比双引号效率要高;如果需要一些特殊的功能,则只能用双引号,如转义,变量替换等。
例:
$test = "world";
echo "hello {$test}";
// 输出 hello world
echo "hello world\"hello php";
// 输出 hello world"hello php
$test = "world";
echo 'hello {$test}';
// 输出 hello {$test}
echo 'hello world\"hello php'
// 输出 hello world\"hello php
页:
[1]