学习php笔记 字符串处理
作者:bea
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为
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()根据区域设置格式化本地时间/日期。
有用 | 无用
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编程最快明白》第六讲:Mysql数据库操作
- 《PHP编程最快明白》第五讲:php目录、文件操作
- 《PHP编程最快明白》第四讲:日期、表单接收、session、cookie
- 《PHP编程最快明白》第三讲:php数组
- 《PHP编程最快明白》第二讲 数字、浮点、布尔型、字符串和数组
- 一篇有意思的技术文章php介绍篇
- 理解php原理的opcodes(操作码)
- PHP下常用正则表达式整理
- PHP编程最快明白(第一讲 软件环境和准备工作)
- 微盾PHP脚本加密专家php解密算法
- smarty中先strip_tags过滤html标签后truncate截取文章运用
- php正则过滤html标签、空格、换行符的代码(附说明)
- PHP 强制下载文件代码
- PHP 分页类代码(简单好用型)
- php下网站防IP攻击代码,超级实用
- php 实现进制转换(二进制、八进制、十六进制)互相转换实现代码
- php park、unpark、ord 函数使用方法(二进制流接口应用实例)
- php通过文件头检测文件类型通用代码类(zip,rar等)
- php empty,isset,is_null判断比较(差异与异同)