Tutorialsplane

PHP chunk_split Function


PHP chunk_split() Function : This Functions splits the string in series of smaller parts.

PHP chunk_split Function Syntax

chunk_split(string,length,end)

String : Required String input parameter.
Length : Optional , Number – The length of chunks. Default is 76.
End : Optional : String – Defines what to place at the end of each chunk. Default is \r\n

PHP chunk_split() function Example 1

$string = "Hello Tani!";
$chunk_split = chunk_split($string,3,'---');
echo $chunk_split;

Try it »

PHP chunk_split() function Example 2

$string = "Hello Tani!";
$chunk_split = chunk_split($string,1,'_');
echo $chunk_split;

Try it »

Output of the above Example will be as below:

PHP chunk_split() Function

PHP String Functions