首页 > Web开发 > 详细

学习php笔记 字符串处理

时间:2016-02-06 21:11:47      阅读:218      评论:0      收藏:0      [点我收藏+]
substr();

substr(str,start,length);

例:substr(‘php is very good language‘,4,5);

输出为 is ve;

当start>str的长度,则返回为();

substr(‘php is very good language‘,26,5);

substr(‘php is very good language‘,4);

输出为 (空白)

输出为is v (表明start和langth都为4)

当start为负值,则从str末尾出开始读起(*这时是从-1开始读,而不是从0开始),

substr(‘php is very good language‘,-4,5);

输出为uage

当length为负值时,length代表的是从末尾开始读,截取str的结束位置。

substr(‘php is very good language‘,4,-5);

输出为is very good lan

explode()把函数字符串分割为数组;

strrev()把函数字符串

setlocalhost(content location)设置本地环境.content ,指定需要设置的场景信息常量有(

LC_ALL – 所有下属的常量
LC_COLLATE – 排列顺序
LC_CTYPE – 字符分类和转换(例如:将所有的字符转换成小写或大写形式)
LC_MESSAGES – 系统信息格式
LC_MONETARY – 货币 / 通货格式
LC_NUMERIC – 数值格式
LC_TIME – 日期和时间格式
);location,设置国家区域,例如,chs.

strftime()根据区域设置格式化本地时间/日期。

学习php笔记 字符串处理

原文:http://www.jb51.net/article/25031.htm

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!