继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

php中的chunk_split()和str_split()字符串函数

至尊宝的传说
关注TA
已关注
手记 129
粉丝 82
获赞 465

chunk_split(string $string,[,int $length[,string $end="\r\n"]]),将字符串按一定长度分割,结果返回分割后的字符串。str_split(string $string[,int $length=1])将字符串按一定长度进行分割,结果返回一个数组,分割后的每个串就是数组的单元。

<?php

$str="hello world";

echo chunk_split($str,3,"end");//结果返回helendlo endworendldend

print_r str_split($str,3);//结果返回Array([0]=>hel [1]=>lo  [2]=>wor [3]=>ld)

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP