using a regular expression to trim whitespace
| From: | ..s.c.o.t.t.. | Date: | Sun, 18 Feb 2001 16:10:20 +0000 |
| Subject: | using a regular expression to trim whitespace | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-40427@lists.php.net to get a copy of this message | ||
there's a much easier way to get rid of whitespace
and linebreaks at the end of a variable than using a
looped ereg_replace (as i previously suggested)
1) use trim()
2) use preg_replace('/\s*$/', '', $input)
both will cremate spaces and linebreaks