Home > Article > Backend Development > php trim removes space characters and specified characters_PHP tutorial
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;
?>?>