This article introduces to you the chunk_split() function of PHP. Now I share it with you. Friends in need can refer to it
#The chunk_split() function splits a string into a series of smaller parts.
Note: This function does not change the original string.
chunk_split(string,length,end)
Description | |
---|---|
Required. Specifies the string to be split. | |
Optional. A number defining the length of the string block. Default is 76. | |
Optional. A string defining what is placed after each string block. Default is \r\n. |
Return value: | Returns the split string. |
---|---|
PHP version: | 4 |
在每个字符后分割一次字符串,并在每个分割后添加 ".":
源代码:
运行结果:
H.e.l.l.o. .w.o.r.l.d.!.
在每六个字符后分割一次字符串,并在每个分割后添加 "...":
源代码:
运行结果:
Hello ...world!...
Related recommendations:
php splits a string into a series of smaller parts function chunk_split()
10 recommended articles about the string function chunk_split()
chunk_split( in php ) function usage introduction
The above is the detailed content of PHP's chunk_split() function. For more information, please follow other related articles on the PHP Chinese website!