Home >php教程 >PHP开发 >PHP learning to delete string whitespace characters

PHP learning to delete string whitespace characters

黄舟
黄舟Original
2016-12-20 11:47:141509browse

Learn to delete string whitespace characters in php.
You can use the trim( ), ltrim( ), and rtrim( ) functions to remove the blanks at the masthead or end of a string:
$trimmed = trim(string[,charlist]);
$trimmed = ltrim(string[,charlist]);
$trimmed = rtrim(string[,charlist]);
trim() returns a copy of the string with leading and trailing spaces removed
ltrim() (l means left) does the same job, but only removes the string Whitespace on the left
rtrim() (r means right) only removes whitespace on the right of the string.

The above is the content of PHP learning to delete string whitespace characters. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
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