Originally Posted by LovingSticky
You should also not use [dot] to concat strings, much faster is to use comma, as it does not concat them, but just echoes them.
So, this is fastest:
echo '1', $itemid;
This is slower:
And this would be slowest:
All those examples produce same result, of course.
I haven't tried it, but it seems that the , concat is not actually concatenation but a separator for multiple arguments to echo, and thus is not a general purpose replacement for . concatenation. It's a useful suggestion for using echo, but keep in mind that premature optimization is the root of all evil so obfuscating your code to take advantage of this is probably not a good idea (unless of course you discover that you're taking a significant performance hit from that code, but then that wouldn't be premature optimization either
). Also, it doesn't apply to the example because the result of the concatenation is being assigned to a variable, not echo'd.
So I guess my point is that it's a useful tip, but your statement that "You should also not use [dot] to concat strings" is not correct without qualification.