21322121 发表于 2015-11-17 09:20:49

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

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(=>hel =>lo=>wor =>ld)
页: [1]
查看完整版本: php中的chunk_split()和str_split()字符串函数