PHP chunk_split() Function

PHP chunk_split() Function splits a string into a series of smaller parts.

Syntax :

chunk_split(string,length,separator)

Parameter,

PHP chunk_split() Function
Parameter Description
string Required.Needs the string to split
length Optional.Specifies the length of the chunks. Default length is 76. Chunk length should be greater than zero.
separator Optional. Defines string to place at the end of each chunk. Default is space (\r\n).

chunk_split() Function returns chunked string.

 

Let's see below example to understand php chunk_split() Function in details.

Example :

<?php
$str = "Learn chunk split Function at aryatechno!";
echo "<br>With separator :".chunk_split($str,3,":");

$str = "Learn chunk split Function at aryatechno!";
echo "<br>Without separator : ".chunk_split($str,3);

?>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

78648