Removing whitespace from between HTML tags

Does anyone know how to turn this:


         <table>
         <tr>
            <th align='right'>Service Area:</th>
            <th align='right'>Union</th>
            <th align='right'>South Carolina</th>
         </tr>
         </table>

…into this?

<table><tr><th align='right'>Service Area:</th><th align='right'>Union</th><th align='right'>South Carolina</th></tr></table>

This should work, assuming that input is valid HTML.


$html = preg_replace('~>\\s+<~m', '><', $html);

That great! Thanks.