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

php remove all spaces in string trimall

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 09:07:30
Original
1264 people have browsed it

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>
Copy after login
').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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template