chunk_split

string chunk_split(string string, [int chunk_length], [string chunk_ending]) 
string String to split into chunks
chunk_length Length of the chunks (default 76)
chunk_ending Character(s) to place at the end of each chunk (default \r\n)

Breaks a string into a series of smaller chunks.

Returns:

String with chunk_ending placed every chunk_length

Description:

chunk_split() adds the character(s) specified in chunk_ending every chunk_length characters. This function is useful for breaking certain types of data into separate lines of a specified length. It’s often used to make base64 encoded data conform to RFC 2045.

Note:

This function should not be used for breaking long lines of text into shorter lines for display purposes—use ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.