2011-02-09 22 views
0

可能性の重複です:
Difference between single quote and double quote string in php- '' の使用の違いと ""

こんにちはすべて

私はPHPと私に非常に新しいですが、 ''と ''の使用の違いは何かを知りたがっていますか?

おかげ

+6

マニュアルの[strings chapter](http://php.net/manual/en/language.types.string.php)を参照してください –

+2

何かとても基本的なことが分かっていれば、 *他の人の時間を無駄にしない*、してください。 –

+0

このリンクを参照してくださいhttp://stackoverflow.com/questions/3446216/difference-between-single-quote-and-double-quote-string-in-php –

答えて

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 

希望します。

+0

ありがとう! :) – Yoni

関連する問題