Definition
The chunk_split() function splits a string into smaller chunks.
Syntax
chunk_split(string, length, end)
Parameters
Parameter | Description |
---|---|
string |
Required. Specifies the string to split. |
length |
Optional. A number that defines the length of the chunks. Default is 76. |
end |
Optional. A string that defines what to place at the end of each chunk. Default is \r\n. |
Example
<?php
$str = "Welcome to PHP!";
echo chunk_split($str, 6, "...");