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

PHP learning to delete string whitespace characters

黄舟
Release: 2016-12-20 11:47:14
Original
1494 people have browsed it

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)!


Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template