$row['message'] from a MySQL database and I need to remove all whitespace like
\t and so on.
$row['message'] = "This is a Text \n and so on \t Text text.";
should be formatted to:
$row['message'] = 'This is a Text and so on Text text.';
$ro = preg_replace('/\s\s+/', ' ',$row['message']); echo $ro;
but it doesn't remove
\t, just single spaces. Can anyone tell me how to do that?
$ro = preg_replace('/\s+/', ' ',$row['message']);
You are using
\s\s+ which means whitespace(space, tab or newline) followed by one or more whitespace. Which effectively means replace two or more whitespace with a single space.
What you want is replace one or more whitespace with single whitespace, so you can use the pattern