SyntaxFix
Write A Post
Hire A Developer
Questions
$output = preg_replace('/\s+/', ' ',$input);
\s is shorthand for [ \t\n\r]. Multiple spaces will be replaced with single space.
[ \t\n\r]