Home >Backend Development >PHP Tutorial >php remove all spaces in string trimall

php remove all spaces in string trimall

WBOY
WBOYOriginal
2016-07-29 09:07:301257browse

In fact, it is an extension of the trim function
trim can only remove spaces on both sides of the string

<code><span>//删除所有空格</span><span><span>function</span><span>trimall</span><span>(<span>$str</span>)</span>{</span><span>$qian</span>=<span>array</span>(<span>" "</span>,<span>" "</span>,<span>"\t"</span>,<span>"\n"</span>,<span>"\r"</span>);<span>$hou</span>=<span>array</span>(<span>""</span>,<span>""</span>,<span>""</span>,<span>""</span>,<span>""</span>);
    <span>return</span> str_replace(<span>$qian</span>,<span>$hou</span>,<span>$str</span>);    
}</code>
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces PHP trimall to delete all spaces in a string, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Centos66 install apache24Next article:Centos66 install apache24