There are 3 syntax used to declare strings, in PHP <= 5.2 :
- single quoted
- double quoted
- heredoc
With single quotes :
variables and escape sequences for
special characters will not be
expanded
For instance :
echo 'Variables do not $expand $either';
Will output :
Variables do not $expand $either
With double-quotes :
The most important feature of
double-quoted strings is the fact that
variable names will be expanded.
For instance :
$a = 10;
echo "a is $a";
Will output :
a is 10
And, with heredoc :
Heredoc text behaves just like a
double-quoted string, without the
double quotes. This means that quotes
in a heredoc do not need to be
escaped,
For instance :
$a = 10;
$b = 'hello';
$str = <<
Will get you :
a is 10
and "b" is hello.