Home  >  Article  >  php教程  >  php trim 删除空格字符与指定字符

php trim 删除空格字符与指定字符

WBOY
WBOYOriginal
2016-06-02 09:14:111299browse

以前没看trim函数以为他只能删除空白,今天发现它还可以删除"" - null.

"t" - tab ,"n" - new line ,"x0b" - 纵向列表符 ,"r" - 回车 ," " - 普通空白字符,以及用户指定字符.

定义和用法:trim() 函数从字符串的两端删除空白字符和其他预定义字符,可选,规定要转换的字符串,如果省略该参数,则删除以下所有字符:

"" - null,"t" - tab,"n" - new line,"x0b" - 纵向列表符,"r" - 回车," " - 普通空白字符,实例代码如下:

{$str}
";  //  ";   echo $str1;

   


文章链接:

随便收藏,请保留本文地址!

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