I tried a few functions such as str_split()
, chop()
, and explode()
. But they don't quite do what I want.
For example:
$str = "it was the best of times it was the worst of times";
The result I was looking for was to segment the $str
after 5 words.
So it would look like:
$new_str = "it was the best of";
Thank You.