Split up words but not if it contains HTML
<p>I need a function or some regex to split up spaces in a string but to treat an HTML tag as a word.</p>

<pre><code>$str = 'one two &lt;a href=""&gt;three&lt;/a&gt; four';
$x = explode(" ", $str);
print_r($x);

/* Returns:
  Array
(
    [0] =&gt; one
    [1] =&gt; two
    [2] =&gt; &lt;a
    [3] =&gt; href=""&gt;three&lt;/a&gt;
    [4] =&gt; four
)

Looking for way to return:

Array
(
    [0] =&gt; one
    [1] =&gt; two
    [2] =&gt; &lt;a href=""&gt;three&lt;/a&gt;
    [3] =&gt; four
)

*/
</code></pre>

<p>Any ideas? Thanks</p>
