<?php $str = " \tline \t\tline \t\t\tline \t\t} \t} "; $replaced = str_replace("\t", ' ', $str); echo "<pre>{$replaced}</pre>"; ?>