Home >Backend Development >PHP Tutorial >Some usages of PHP trim() function, usage of phptrim function_PHP tutorial

Some usages of PHP trim() function, usage of phptrim function_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:57:241174browse

Some usages of PHP trim() function, usage of phptrim function

  string trim ( string $str [, string $charlist ] ) - Remove whitespace characters (or other characters) at the beginning and end of the string

The trim() function removes spaces, tabs, line feeds, carriage returns, and vertical characters by default when the second parameter is empty. Tab characters, etc., when adding the second parameter

1) trim(' "string"', '"sg'); // Final output: "strin

2) trim(' "string" ', '"sg'); // Final output: "string"

2)trim('"string"', '"sg'); // Final output: trin

 So the trim() function first removes the blank characters at the beginning and end of the characters, and then filters out the given characters (list) to be removed. , also applies to ltrim(), rtrim() functions

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/983852.htmlTechArticleSome usages of PHP trim() function, phptrim function usage string trim ( string $str [, string $charlist ] ) - Remove blank characters (or other characters) at the beginning and end of the string trim() function...
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