title: Safely concatenate multibyte strings
body: <p>I'm looking increasingly into ensuring that PHP apps are multibyte-safe, which mostly involves replacing string manipulation functions with their equivilant mb_* functions.  </p>
  
  <p>However string concatenation is giving me pause for thought.  </p>
  
  <p>Some character encodings (such as UTF-16 unicode) can include a Byte Order Mark at the beginning.  If you concatenated two UTF16 strings it's possible you'd introduce a BOM into the resulting string at a location other than the beginning.  I suspect that there are other encodings that can also include "header" information such that stitching two strings of the same encoding together would also be problematic.  Is PHP smart enough to discard BOMs etc when doing multibyte string concatenations?  I suspect not because PHP has traditionally only treated strings as a sequence of bytes.  Is there a multibyte-safe equivalent to concatenation?  I've not been able to find anything in the mbstring documentation.  </p>
  
  <p>Obviously it would never be safe to concatenate strings that are in different encodings so I'm not worrying about that for now.  </p>