PHP go space has the correlation function trime, he can remove two spaces or directly use LTrim and RTrim function results with trim, if you want to delete all the spaces only use str_replace replaced.
Usually over the space, is generally used trim, found today, the middle of the space to go. Pour, check the instructions to know, trim can only go to both ends, such as $abc = a b c; , with trim can only remove the space behind a front C, but what about the space around B? Str_replace out, that's it.
The code is as follows |
Copy Code |
Str_replace (",", $ABC). |
Need to go to the space of the students carefully, PHP to space, trim not, str_replace line, but trim can remove the head space as follows
Cases
The code is as follows |
Copy Code |
Trim removes a string at both ends of a space, RTrim is to remove a string to the right of the space, LTrim is to remove the left space of a string. Echo Trim ("Space www.bKjia.c0m"). " "; echo RTrim ("Space"). " "; Echo LTrim ("Space"). " "; ?> |
The effect is the same as the str_replace.
http://www.bkjia.com/PHPjc/633056.html www.bkjia.com true http://www.bkjia.com/PHPjc/633056.html techarticle PHP Go space has the correlation function trime, he can remove two spaces or directly use LTrim and RTrim function results with trim, if you want to delete all the spaces only use str_replace replaced. ...