First, let’s explain each one separately,
trim filters both ends of the string,
rtrim filters the tail of the string, =chop()
ltrim filters the beginning of the string.
To filter out the key in a string, you can only use str_replace.
Give me an example,
PHP code
Copy code The code is as follows:
$str = '123,333,234,';
echo rtrim ($str, ',');
rtrim example code 2
Copy code The code is as follows:
$text = "ttThese are a few words :) ... ";
$trimmed = rtrim($text);
// $trimmed = "ttThese are a few words :) ..."
$trimmed = rtrim($text, " t.");
// $trimmed = "ttThese are a few words :)"
$clean = rtrim($binary, "x00..x1F ");
// trim the ASCII control characters at the end of $binary
// (from 0 to 31 inclusive)
?>
http://www.bkjia.com/PHPjc/326706.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326706.htmlTechArticleFirst explain separately, trim filters both ends of the string, rtrim filters the tail of the string, =chop() ltrim filter The first part of the string. To filter the keys in the string, you can only use str_replace. For example...