Home / PHP Tips Generated By ChatGPT / Splitting a String by Length in PHP Split a string into chunks of a specified length with str_split(). Source Code $string = "HelloWorld"; $chunks = str_split($string, 5); print_r($chunks);