时间:2021-07-01 10:21:17 帮助过:27人阅读
<?php $text = "\t\tThese are a few words :) ... "; $binary = "\x09Example string\x0A"; $hello = "Hello World"; $str = "##\t使用函数trim去掉字符串两端特定字符####"; $new_text = trim($text); $new_binary = trim($binary); $new_hello = trim($hello); $new_str = trim($str,"#"); echo $new_text; //These are a few words :) ... echo $new_binary; //Example string echo $hello; //Hello World echo $new_str; //使用函数trim去掉字符串两端特定字符 ?>
以上函数功能,同时适用于ltrim()、rtrim(),这2个函数
1、ltrim();删除字符串开头的空白字符(或其他字符)
2、rtrim();删除字符串末端的空白字符(或者其他字符)
以上就是PHP函数trim()实例的详细内容,更多请关注Gxl网其它相关文章!