PHP chunk_split() Function


The chunk_split() Splits a string into smaller sections and inserts a specific delimiter between each section.

Syntax
chunk_split(string,length,end)
Parameters
  • string - (Required) The string to be split.
  • length - (Optional) The length of each chunk.(Default is 76)
  • end - (Optional) Delimiter string to insert between each block. (Default is \r\n)
Example
<?php
echo chunk_split("Welcome",3,"-");
?>

Output

Wel-com-e-

Prev Next