Created
July 14, 2013 06:06
-
-
Save umidjons/5993361 to your computer and use it in GitHub Desktop.
Replace multiple spaces with one using preg_replace()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $str = preg_replace('/\s\s+/u', ' ', $str); // no issue with cyrillic letters, because using "u" modifier for UTF-8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment