Use an array rather than multiple $str .= '.... when constructing a long string?

i was reading and learning a bit about python recently and in the book it recomended, when contstructing a string, to use an array then join the array together once at the end, rather than doing the python equivalent of this:

$string = ‘asdasdfdsff’;
$string .= ‘dfgfggdsfdgfd’;
$string .= ‘asdfdfgfdgdf’;

because in python the string has to get remade everytime (presumably this only really matters on large strings).

does the same efficiency issue effect php? if you’re doing $string .= 'dfgfgg… with long strings multiple times is it going to be (much?) more efficient to only construct the long string once, right at the end by using an array for the ongoing collection? i guess so but just want to check.


Put concisely, no. (:

ok, thanks.