I noticed recently that there are two ways to print multiple statements in PHP.
echo $a.$b; // Echo's $a and $b conjoined, and
echo $a,$b; // Echo's $a and echo's $b.
Is there any point in time where the difference between these two syntaxes matters?
Realistically, no.
echo $a.$bfirst concatenates$aand$binto a new string, then passes it as a parameter toecho, which prints it out.echo $a,$bgives two parameters toecho, which will print both out.The latter is slightly more efficient. Not in any way that you would normally notice though.
There is a difference in how it is evaluated.
echo $a, $bis like writingecho $a; echo $b;, two separate calls.$bwill be evaluated after$aisecho‘d. This can make a difference if your arguments are function calls which themselvesechosomething, but again, in practice this should be irrelevant, since it’s bad practice.