Having used Java for a long time my standard method for creating long strings piece by piece was to add the elements to an array and then implode the array.
One (subtle) difference is clearly visible when generating a character-seperated string:
The first one will print a,b where the latter will print a,b,. So unless you're using an empty string as a seperator, as you did in your example, it's usually preferred to use implode().