A simple guide to using the trim () function in PHP, Trim usage Guide
String Trim (String $str [, String $charlist])-removes whitespace characters (or other characters) from the beginning and end of a string
Trim () function when the second
Remove the space before and after.
Suppose there is a string "DDD dd D", after trim () becomes "DDD dd D".
If you can remove the extra space on both sides (including tabs), but not the middle space.
The trim () function in PHP is the same as the use
Everyone is writing
Definition and Usage
The PHP function trim () removes whitespace characters and other predefined characters from both ends of the string.
Grammar
Trim (str,charlist) parameter 1 str is the string to be manipulated, parameter 2
The trim () function removes spaces and other predefined characters from both ends of the string. Remove leading and trailing spaces.
Assume that there is a string "ddd dd d", which is "ddd dd d" after Trim ".
You can remove unnecessary spaces
Remove leading and trailing spaces.Assume that there is a string "ddd dd d", which is "ddd dd d" after Trim ".You can remove unnecessary spaces (including tabs) on both sides, but do not remove spaces in the middle.The trim () function in PHP has
Definition and Usage
The trim () function removes white-space characters and other predefined characters from both ends of the string.
Grammar
Trim (string,charlist) parameter description
string is required. Specifies the string to
Remove the space before and after.
Suppose there is a string "DDD dd D", after trim () becomes "DDD dd D".
If you can remove the extra space on both sides (including tabs), but not the middle space.
The trim () function in PHP is the same as the
Remove the space before and after.
Suppose there is a string "DDD dd D" that becomes "DDD DD D" after trim ().
You can remove extra spaces (including tabs) on either side, but you can't remove the middle space.
The trim () function in PHP is the
PHP LTrim (), RTrim () and trim () Delete Word spaces instances, Ltrimrtrim
This example describes how to delete a word spaces in PHP ltrim (), RTrim (), and trim (). Share to everyone for your reference. The specific analysis is as follows:
The
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,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.