Call echo With Commas

../_images/echo-comma.png

The most efficient way to call echo is to use commas. Each argument of echo is then sent to the output. Echo is not a function, but a language construct, with this special ability.

echo is sometimes used with parenthesis: it makes it look like an actual function call. Yet, it also reduces the number of arguments from arbitrary to one: there can be only one element inside a parenthesis.

Hence, any list of several arguments passed to echo is concatenated into one. This is a useless concatenation, as it is immediately discarded. And echoing the arguments one after the other does the same job.

In the end, it is a micro-optimisation anyway.

See Also

PHP Features