Php filters all blank characters (spaces, full-angle spaces, line breaks, and so on), with full-angle line breaks. Php filters all blank characters (spaces, full-angle spaces, line breaks, etc.). the trim function that comes with full-angle line breaks in php can only replace spaces at both ends of the left and right, in some cases, php does not filter all blank characters (spaces, full-angle spaces, line breaks, etc.), and the full-angle line breaks
The self-contained trim function in php can only replace spaces on both sides of the left and right. in some cases, it may not be easy to use, if you want to filter out all the spaces (spaces, full-width spaces, line breaks, etc.) in a string, you can write a filter function by yourself.
Php learns str_replace functions and can be replaced in batches. Therefore, we can use the following source code to replace and filter all the blank characters in a string.
<? Php $ str = 'jkgsdgsgsdgs gsdg gsd'; echo myTrim ($ str); function myTrim ($ str) {$ search = array ("", "", "\ n ", "\ r", "\ t"); $ replace = array ("", ""); return str_replace ($ search, $ replace, $ str) ;}?>
Run the code and the page output: jkgsdgsgsdgsgsdggsd, which perfectly achieves the desired effect.
The above is the php method for filtering all the blank characters. I hope it will be helpful for your learning.
Trim (space, FULLWIDTH space, line feed, etc.). the trim function that comes with the full-width line feed in php can only replace the spaces on both sides of the left and right. in some cases, it is not very good...