Home > php教程 > php手册 > body text

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

WBOY
Release: 2016-06-02 09:14:11
Original
1297 people have browsed it

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

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

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

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

{$str}
Copy after login
"; // "; echo $str1;

   


文章链接:

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!