PHP trim paragraph

PHP to trim whitespace from begining and end of every line in a paragraph block

input
			<div class="first">
			<h5>#name#</h5>
			<img src=#image# alt=#alt</>
			<p>#desc#</p>
			<a href=#url#>#name#</a>
			</div>


output
<div>
<h5>#name#</h5>
<img src=#image# alt=#alt</>
<p>#desc#</p>
<a href=#url#>#name#</a>
</div>


PHP code
    function trimparagraph($s)
    {
        // trim whitespace at begining and end of every line in a paragraph block

        $s = implode( "\n", array_map( "trim", explode( "\n", $s ) ) ) ;

        return $s ;
    }


REFERRERS
PHP
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki