The following snippet will remove double white space, tabs, and line breaks from a string.
$output = preg_replace('!\s+!', ' ', $input);
\d, \w and \s
Shorthand character classes matching digits, word characters (letters, digits, and underscores), and whitespace (spaces, tabs, and line breaks). Can be used inside and outside character classes.
\s is shorthand for