2011-02-09 37 views

回答

0

雙引號會評估字符串的內容,而單引號不會。

$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 

這是一個性能比較的問題太多,「事業評價時間影響的解釋,但現在與當前的(最小)的硬件,它不是一個問題了。

3
$name='RkReddy'; 

echo "$name hi hello"; //op-RkReddy hi hello 

echo '$name hi hello';//op-$name hi hello 
0

沒什麼,但使用雙引號時,你可以使用字符串內使用PHP變量,該字符串將輸出變量的值。當使用單引號時,它將輸出變量的名稱而不解析實際值。 IE:

$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 

希望這有助於!