I need to split text into two parts which this function does but it cuts off in the middle of a word, I need it to work out the start or end of a word give or take a few characters.
I cannot base it on word count as I need the character range to be no more than 130 characters.
$str = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum"
$first125 = substr($str, 0, 125);
$theRest = substr($str, 125);
Thanks
Here’s a very basic solution to what you’re trying to do to get you started
but there are more things to consider, for example with that solution, if the 125th character is a space after a word ends, it’ll include another word beyond that, so you might want to add some additional checking methods to try and make it as accurate as possible.