如何在不使用正则表达式的情况下从txt文件中删除 \ t?

Input: The input is read from a text file: while ($data = FGets($soubor)) { ... }.

Output: I would like to safe content to DB (import) without \t.

I think, that it offers an alternative for trim:

while () ...
$editedText = trim($data, "\t");

I need \t, and check in whole txt document. Any suggestions and samples?

What is the best way for this easy task without RE?

The str_replace() function is your new best friend.


$editedText = str_replace(array("\t", "
"), "", $data);

I use

 s.trim();

it helps to lose whiteSpace, , \t and so on from both ends of the string.