$string = \"My text has so much whitespace Plenty of spaces and tabs\"; echo preg_replace(\"/\\s\\s+/\", \" \", $string);
why you are doing like this? html displays only one space even you use more than one space...
For example:
test content 1 2 3 4 5
The output willl be: test content 1 2 3 4 5
if you need more than single space in html, you have to use