学习php笔记 字符串处理
2019/6/30 15:26:36
本文主要是介绍学习php笔记 字符串处理,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
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笔记 字符串处理的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-07-03php客户端微信小程序根据分享携带参数进入指定页面-icode9专业技术文章分享
- 2024-07-02phpstrom链接ftp 提示上传成功 但是ftp代码没变-icode9专业技术文章分享
- 2024-06-30百度空间安装易优,如何去除URL中的index.php-icode9专业技术文章分享
- 2024-06-30宝塔Linux服务器隐藏index.php-icode9专业技术文章分享
- 2024-03-29env: php: no such file or directory
- 2024-03-01php foreach break
- 2024-02-26Exception参数 php-icode9专业技术文章分享
- 2023-12-30PHP文件批量上传-icode9专业技术文章分享
- 2023-12-30thinkphp6 withJoin-icode9专业技术文章分享
- 2023-12-27MagicArray:像php一样,让Go业务代码不再卷!