Forum Moderators: coopster
Or. in case you wanted to strip extra whitespace:
<?php
$str = 'foo o';
$str = preg_replace('/\s\s+/', ' ', $str);
// This will be 'foo o' now
echo $str;
?>
This info came from the PHP manual, on the preg_replace page.
php.net/manual/en/function.preg-replace.php