chunk_split
PHP chunk_split()函数 (PHP chunk_split() function)
chunk_split() function is used to split the given string into chunks of small parts, it accepts the string returns the parts of the strings specified by the other parameters.
chunk_split()函数用于将给定的字符串分割成小块,它接受该字符串返回其他参数指定的字符串部分。
Syntax:
句法:
    chunk_split(string, [chunklen], [end_characters]);
Here,
这里,
- string - is the source string - string-是源字符串 
- chunklen - is an optional parameter, it defines the number of characters of the chunks. It's default value is 75. - chunklen-是一个可选参数,它定义块的字符数。 默认值为75。 
- end_characters - is also an optional parameter, it defines the end characters that will be added to the each chunk, and its default value is "\r\n". - end_characters-也是一个可选参数,它定义了将添加到每个块中的结束字符,其默认值为“ \ r \ n” 。 
Examples:
例子:
    Input: 
str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Function call: chunk_split(str, 3, "...");
Output:
ABCD...EFGH...IJKL...MNOP...QRST...UVWX...YZ... 
PHP code:
PHP代码:
<?php
$str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$split_str = chunk_split($str);
echo ("The extracted characters are...\n");
echo ($split_str);
$split_str = chunk_split($str, 3);
echo ("The extracted characters are...\n");
echo ($split_str);
$split_str = chunk_split($str, 4, "...");
echo ("The extracted characters are...\n");
echo ($split_str);
?>
Output
输出量
The extracted characters are...
ABCDEFGHIJKLMNOPQRSTUVWXYZ
The extracted characters are...
ABC
DEF
GHI
JKL
MNO
PQR
STU
VWX
YZ
The extracted characters are...
ABCD...EFGH...IJKL...MNOP...QRST...UVWX...YZ... 
翻译自: https://www.includehelp.com/php/chunk_split-function-with-example.aspx
chunk_split