Is there any quick way to replace x amount of spaces with only one?
ex. (assume '-' is one space)
Before: This is----a---test------string
After: This is a test string
Stripping whitespace
Moderator: General Moderators
-
HiddenS3crets
- Forum Contributor
- Posts: 119
- Joined: Fri Apr 22, 2005 12:23 pm
- Location: USA
sure:
Code: Select all
$str = preg_replace('\s+', ' ', $str);