On echoing strings

This works:

[sourcecode language='php']

echo “

“;

[/sourcecode]

This does not

[sourcecode language='php']

echo

;

[/sourcecode]

This works:

[sourcecode language='php']

echo “

“.$name.”

“;

[/sourcecode]

This does not:

[sourcecode language='php']

echo “

“$name”

“;

[/sourcecode]

This works

[sourcecode language='php']

echo “Name: “.$name;

[/sourcecode]

This does not:

[sourcecode language='php']

echo “Name: “$name;

[/sourcecode]

This does not:

[sourcecode language='php']

echo Name: .”$name”;

[/sourcecode]

In other words: echo has to be followed by a string. This can be a “string literal”– which means a string surrounded by ‘ ‘ or by ” “. E.g.,

[sourcecode language='php']

echo “hello, world”;

[/sourcecode]

This can be a string stored in a variable. E.g.,

[sourcecode language='php']

echo $something;

[/sourcecode]

This can be a combination of string literals and/or variables connected by the concatenation symbol (.). For example:

[sourcecode language='php']

echo $something.$somethingelse;

echo “This is “.$something;

echo “This is “.”three string literals “.”chained together for no reason.”;

echo “Our “.$somerelative.” who art in “.$somelocation.”, “.$someattribute.” be thy “.$somenoun.”. “;

[/sourcecode]