I need to split an up to 2000 characters long text into 130 character long parts to store every single one into a database.
How to split the text into 130 character parts?
Take a look at chunk_split()
and wordwrap()
. Combined with explode()
you could get an array of 130 character lines.
$chunks = explode('##', chunk_split($string, 130, '##'));
print_r($chunks);
Note: I've chosen ##
as a delimiter. This may need to be adjusted depending on your string.