Remove the spaces before and after.
Suppose there is a string "ddd dd d", which becomes "ddd dd d" after Trim().
As above, you can remove the extra spaces on both sides (including the formatting) symbol), but the spaces in the middle cannot be removed.
The trim() function in PHP is used the same as the trim() function in ASP. If you have been in contact with ASP, you will naturally use it.
Usage It is relatively simple. Add the following to the variable where you want to remove spaces:
echo trim($variable);
?>
Generally used for user password processing middle.
Definition and Usage
trim() function removes whitespace characters and other predefined characters from both ends of a string.
Syntax
trim(string,charlist) Parameter Description
string Required. Specifies the string to check.
charlist optional. Specifies the string to be converted. If this parameter is omitted, all following characters are removed:
"
http://www.bkjia.com/PHPjc/318090.html
www.bkjia.comtrue