Monday, January 18, 2010

Using PHP remove the consecutive whitespaces.

Following script will work for remove the newline and remove the consecutive white spaces
       

<? PHP
function remW( $content )

{
$content = trim(ereg_replace(“\n|\r|\r\n|\n\r”, ”, preg_replace(‘/\s+/’, ‘ ‘, $content)));
return $content;

}
        ?>

No comments:

Post a Comment