Heim  >  Artikel  >  Backend-Entwicklung  >  php trim 删除空格字符与指定字符_PHP教程

php trim 删除空格字符与指定字符_PHP教程

WBOY
WBOYOriginal
2016-07-20 11:02:301137Durchsuche

 

以前没看trim函数以为他只能删除空白,今天发现它还可以删除"�" - null
"t" - tab
"n" - new line
"x0b" - 纵向列表符
"r" - 回车
" " - 普通空白字符
以及用户指定字符哦。

$str = "##使用函数trim去掉字符串两端特定字符####";
$str1 = trim($str,"#"); //为函数trim传入第二个参数,trim将删除字符串$str两端的#字符
echo $str."
";
echo $str1;
?>

?>


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445376.htmlTechArticle以前没看trim函数以为他只能删除空白,今天发现它还可以删除 - null t - tab n - new line x0b - 纵向列表符 r - 回车 - 普通空白字符 以及用户指定...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn