This sounds like an interesting problem.
I searched on google for "php count words in a string"
and found this function.
$numwords = count_words($string);
function count_words($string)
{
$string = eregi_replace(" +", " ", $string);
$string = explode(" ", $string);
while (list(, $word) = each ($string))
{
if (eregi("[0-9A-Za-zÀ-ÖØ-öø-ÿ]", $word))
{
$word_count++;
}
}
return($word_count);
}
I didn't try it, but maybe it will help you get in the right direction. It would be very beneficial for you to break it up at a certain number of words.
I can also see reasons for breaking at certain character limits. You might could find a way to make sure there is a space after the break character.
something along the lines of:
if (is_int($numchar/$maxcharforbreak) AND getnextcharacter = " ")
{
print "</td><td>";
}
hope this helps a little..