remove spaces - no line brakes
Posted: Sat Mar 04, 2006 5:21 am
I have this funtion below to:
1. remove multiple spaces from textarea
2. space at the end of the 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
1. remove multiple spaces from textarea
2. space at the end of the string...
Code: Select all
function space($string) {
$string = eregi_replace('^[[]]+', '',preg_replace('/\s+/', ' ', $string));
return $string;
}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