I have the following string which I want to 'clean' from multiple whitespaces:
$string = "This is a test string";
Not a big deal right? However, the string is not 'cleaned' after using:
$string = preg_replace('/\s+/', ' ', $string);
Because, when I output in ISO-8859-1, the string is like this:
$test = "This is a  test string";
So, how can I remove these characters?
preg_replace('/\s+/u', ' ', $string)Âa whitespace charcter?