Possible Duplicate:
Difference between single quote and double quote string in php
Hi all
I am very new to PHP and I wanted to know what is the difference in use of ' ' and " " ?
Thanks
Possible Duplicate:
Difference between single quote and double quote string in php
Hi all
I am very new to PHP and I wanted to know what is the difference in use of ' ' and " " ?
Thanks
$name='RkReddy';
echo "$name hi hello"; //op-RkReddy hi hello
echo '$name hi hello';//op-$name hi hello
Nothing much, but when using double quotes you can use a PHP variable inside the string, and the string will output the variable's value. When using a single quote it will output the variable's name without parsing the actual value. 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
Hope this helps!
Double quotes evaluate the content of the string, the single quotes don't.
$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
It WAS a perfomance issue too, 'cause evaluation time affects the interpreter, but nowadays with the current (minimum) hardware it's not an issue anymore.