Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP中,'';及&引用;_Php - Fatal编程技术网

在PHP中,'';及&引用;

在PHP中,'';及&引用;,php,Php,可能重复: 大家好 我对PHP非常陌生,我想知道使用“”和“”的区别是什么 非常感谢,但是当使用双引号时,可以在字符串中使用PHP变量,字符串将输出变量的值。当使用单引号时,它将输出变量的名称,而不解析实际值。即: $something = "A nice little variable"; echo "$something is printed out"; //output: A nice little variable is printed out echo '$something is

可能重复:

大家好

我对PHP非常陌生,我想知道使用“”和“”的区别是什么


非常感谢,但是当使用双引号时,可以在字符串中使用PHP变量,字符串将输出变量的值。当使用单引号时,它将输出变量的名称,而不解析实际值。即:

$something = "A nice little variable";
echo "$something is printed out"; //output: A nice little variable is printed out
echo '$something is not printed out'; //output: $something is not printed out

希望这有帮助

没什么,但是当使用双引号时,可以在字符串中使用PHP变量,字符串将输出变量的值。当使用单引号时,它将输出变量的名称,而不解析实际值。即:

$something = "A nice little variable";
echo "$something is printed out"; //output: A nice little variable is printed out
echo '$something is not printed out'; //output: $something is not printed out

希望这有帮助

双引号计算字符串的内容,单引号不计算

$var = 123;
echo 'This is the value of my var: $var'; // output: This is the value of my var: $var
echo "This is the value of my var: $var"; // output: This is the value of my var: 123

这也是一个性能问题,因为计算时间会影响解释器,但现在使用当前(最小)硬件,它不再是一个问题。

双引号计算字符串的内容,单引号不计算

$var = 123;
echo 'This is the value of my var: $var'; // output: This is the value of my var: $var
echo "This is the value of my var: $var"; // output: This is the value of my var: 123
这也是一个性能问题,因为评估时间会影响解释器,但现在使用当前(最小)硬件,这不再是一个问题。

请参阅手册中的请参考此链接,如果某些内容非常基本,您知道可以轻松查找,不要浪费其他人的时间,请参阅手册中的请参考此链接如果您知道某件东西非常基本,您可以轻松查找,请不要浪费其他人的时间。