PHP - Remove all tabs from string

前端 未结 5 1519
生来不讨喜
生来不讨喜 2021-02-01 03:21

I am able to remove all single tabs from a string:

// Copying and pasting the tab directly
$txt = str_replace(\"    \", \"\", $txt); 

This only

5条回答
  •  不思量自难忘°
    2021-02-01 03:44

    Try using this regular expression

    $string = trim(preg_replace('/\t/g', '', $string));
    

    This will trim out all tabs from the string ...

提交回复
热议问题