Possible Duplicate:
Difference between single quote and double quote string in php
Hi,
What is the difference between echo 'Test Data';
and echo "Test Data";
in PHP.
Both statements give me same output.
Possible Duplicate:
Difference between single quote and double quote string in php
Hi,
What is the difference between echo 'Test Data';
and echo "Test Data";
in PHP.
Both statements give me same output.
I believe that double quotes allow variables to be replaced by the value :
echo "test = $test";
displays :
test = 2
echo 'test = $test';
displays :
test = $test
Single-quoted strings will not have variables or escape sequences expanded by the interpreter, whereas double-quoted strings will - look at the different output of:
$foo = 'bar';
echo 'This is a $foo';
echo "This is a $foo";
Single-quoted strings are hence marginally 'better' to use as the interpreter won't have to check the contents of the string for a variable reference.