Difference between period and comma when concatenating with echo versus return?

omg picture omg · Sep 23, 2009 · Viewed 29.1k times · Source

I just found that this will work:

echo $value , " continue";

but this does not:

return $value , " continue";

While "." works in both.

What is the difference between a period and a comma here?

Answer

Gumbo picture Gumbo · Sep 23, 2009

return does only allow one single expression. But echo allows a list of expressions where each expression is separated by a comma. But note that since echo is not a function but a special language construct, wrapping the expression list in parenthesis is illegal.