PHP function to Strip all white space

A really simple function to strip all white space and replace it with a single space. Including all tabs, newlines, etc..

$str = preg_replace("'\s+'", ' ', $str);

Leave a Reply

Your email address will not be published. Required fields are marked *