您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php的字符串格式化

2024/3/30 22:39:52发布23次查看
1.字符串的整理:chop(),itrim(),trim()
trim()函数用来整理用户输入数据,如下显示:
$name=trim($name);
$email=trim($email);
tirm()函数可以去除字符串开始位置和结束位置的空格,并将结果字符串返回。默认情况下去除换行符(n)回车符(r)水平(t)和垂直制表符(x0b) 字符串结束符号()和空格。
以下是来自于手册
without the second parameter, rtrim() will strip these characters:
* (ascii 32 (0x20)), an ordinary space.
    * t (ascii 9 (0x09)), a tab.
    * n (ascii 10 (0x0a)), a new line (line feed).
    * r (ascii 13 (0x0d)), a carriage return.
    * (ascii 0 (0x00)), the nul-byte.
    * x0b (ascii 11 (0x0b)), a vertical tab
example#1 usage example of rtrim()
上例将输出:
string(32)         these are a few words :) ... 
string(16)     example string
string(11) hello world
string(30)         these are a few words :) ...
string(26)         these are a few words :)
string(9) hello wor
string(15)     example string
函数explode() implode() join()
explode — 使用一个字符串分割另一个字符串
字符串的排序 strcmp() strcasecmp() strnatcmp()
在字符串中查找字符串 strstr() strchr() strrchr() stristr()
太多了,慢慢看手册
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product