Nick Pisarro writes:
by doing "$s .= $txt;" operations
Whoops!
"$s .= $txt" is a string append operation!!. I used a poor example.
So a question becomes is how PHP treats this operation and/or 'implode'.
It may treat "$s .= $txt' internally as "$s = $s . $txt" or it may be
smarter than that. Likewise 'implode' could do the whole operation at
once, or, it could it break down into a series of appends or concatenates.
Many garbage collecting string handling languages would tend to never
modify existing strings, but always create new ones. Short of finding an
ultra PHP maven who knows the answer to these questions, some timing tests
of the functions might be required to figure this out.
While the "$s .= $txt" may not be a good example, there are other places
where replaces or true concatenates are done in MediaWiki that could be
optimized.
Nick Pisarro