I have this funtion below to:
1. remove multiple spaces from textarea
2. space at the end of the string...
function space($string) {
$string = eregi_replace('^[[:space:]]+', '',preg_replace('/\s+/', ' ', $string));
return $string;
}
How can avoid removing the line breaks?
example:
Hi...
How are you?
with the function above it will result
Hi... How are you?
... removing me the line break and I only want to remove extra spaces