php chunk_split() function
Translation results:
English [tʃʌŋk] US [tʃʌŋk]
n. A thick piece; (something) a considerable amount or part; a strong, strong horse
Plural: chunks
php chunk_split() functionsyntax
Function: Split the string into a series of smaller parts.
Syntax: chunk_split(string,length,end)
##Parameters:
Description | |
Required. Specifies the string to be split. | |
Optional. Numeric value that defines the length of the string block. The default is 76. | |
Optional. A string value that defines what to place at the end of each string block. The default is \r\n. |
Description: chunk_split() function splits a string into a series of smaller parts. This function does not change the original string.
php chunk_split() functionexample
<?php $str = "Hello php.cn!"; echo chunk_split($str,3,"..."); ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
Hel...lo ...php....cn...!...
<?php $str = "Learning PHP is a good choice!"; echo chunk_split($str,4,"***"); ?>
Run Instance»
Click the "Run Instance" button to view the online instance
Output:
Lear***ning*** PHP*** is ***a go***od c***hoic***e!***