本文共 1172 字,大约阅读时间需要 3 分钟。
chunk_split
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代码:
Output
输出量
The extracted characters are...ABCDEFGHIJKLMNOPQRSTUVWXYZThe extracted characters are...ABCDEFGHIJKLMNOPQRSTUVWXYZThe extracted characters are...ABCD...EFGH...IJKL...MNOP...QRST...UVWX...YZ...
翻译自:
chunk_split
转载地址:http://sxtzd.baihongyu.com/