PHP chunk_split() Function
Example
Split the string once after each character and add "." after each split:
Run Example »
Definition and Usage
The chunk_split() function splits a string into a series of smaller chunks.
**Note:** This function does not change the original string.
Syntax
chunk_split(
string,length,end
)
| Parameters | Description |
|---|---|
| string | Required. Specifies the string to split. |
| length | Optional. A number defining the length of each chunk. Default is 76. |
| end | Optional. A string defining what is placed after each chunk. Default is \r\n. |
Technical Details
| Return Value: | Returns the split string. |
|---|---|
| PHP Version: | 4+ |
More examples
Example 1
Split the string once after every six characters and add "..." after each split:
Run Example »
PHP String Reference Manual