$data
包含制表符、前导空格和多个空格.我希望用空格替换所有选项卡.多个空格一个空格,并去除前导空格.
$data
contains tabs, leading spaces and multiple spaces. I wish to replace all tabs with a space. Multiple spaces with one single space, and remove leading spaces.
事实上,会改变这个输入数据的东西:
In fact somthing that would turn this input data:
[ asdf asdf asdf asdf ]
进入输出数据:
[asdf asdf asdf asdf]
我该怎么做?
$data = trim(preg_replace('/s+/g', '', $data));
这篇关于如何在 PHP 中的变量中用空格替换制表符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!