chunk_split() function in PHP || PHP chunk_split() function

chunk_split() function in php

Last Updated by Pooja Chikara 27-Apr-20

0 341

PHP chunk_split() function is used to breaks a PHP string into a number of parts separated by a user-defined term and return modified string. It is an inbuilt function of PHP.


chunk_split($string, $length, $separater);


  • $string is a PHP string. It is mandatory.
  • $length is the length of every smaller part chunked by this function. It is also mandatory.
  • $separater is the user-defined character which used to separate each chunked parts. It is also a mandatory parameter.


$string="Ram's son goes to his school in the morning.\n";
echo "Old string is : $string <br>";
echo "New String is :$new_string";


chunk_split() function in php


Leave a Reply

    Waiting for your comments