Created
February 1, 2018 10:27
-
-
Save kobus1998/5baa367ae2d36db2a6512750e6aca2c3 to your computer and use it in GitHub Desktop.
Replace multiple whitespace to single whitespace
This file contains 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 = "a bc | |
d e f"; | |
$regex = "/[^\S\n]+/"; | |
$str = preg_replace($regex, " ", $str); | |
echo $str; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment