Quote the text in double quotes like this
str_replace("\t", ' ', $str);
PHP will interpret special characters in double-quoted strings, while in single-quoted strings it will just leave the string, except for \' .
Old and deprecated answer:
Copy the tab character ("") from notepad, database row or this message and add this code:
str_replace(' ',' ',$str);
(this is not four spaces, it is a tab character that you copied from notepad)
source share