Home  >  Article  >  Backend Development  >  php trim removes space characters and specified characters_PHP tutorial

php trim removes space characters and specified characters_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:02:301189browse

I didn’t look at the trim function before and thought it could only delete blanks. Today I discovered that it can also delete "�" - null
"t" - tab
"n" - new line
"x0b" - vertical list character
"r" - carriage return
" " - normal whitespace character
And user-specified characters.

$str = "##Use the trim function to remove specific characters at both ends of the string####";
$str1 = trim($str,"#"); //Pass in the second parameter to the function trim. Trim will delete the # characters
at both ends of the string $str. echo $str."
";
echo $str1;
?>

?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445376.htmlTechArticleI didn’t look at the trim function before and thought it could only delete blanks. Today I discovered that it can also delete - null t - tab n - new line x0b - vertical list character r - carriage return - ordinary whitespace characters and user-specified...
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