title: How to add spaces around a substring if spaces aren't already there yet?
body: <p>Example input string: <code>test:)test:)test:) :) test:p test</code><br />
  Wanted output string: <code>test :) test :) test :) :) test :p test</code></p>
  
  <p>As you can see in the example above, I want to parse the string and produce an output string with spaces added around all predefined smiley codes.<br /></p>
  
  <p>I was trying to do this with a couple of loops but in the end it didn't work 100% as expected and it was terribly slow on big documents.</p>
  
  <p>So I'm wondering what would be the best and most efficient way to do this kind of parsing with PHP?</p>