This is the code I've been using. Fairly long-winded as I have broken down the comments into each word, then checked each words' length, then print word. Although this way actually cuts off the word, but I don't think there are any actual words higher than 50 chars in length 🙂
list ($wd0, $wd1, $wd2, $wd3, $wd4, $wd5, $wd6, $wd7, $wd8, $wd9, $wd10, $wd11, $wd12, $wd13, $wd14, $wd15, $wd16, $wd17, $wd18, $wd19, $wd20) = split ('[ ]', $comments);
$wd0=(strlen($wd0)>50)?substr($wd0,0,50)." ":"$wd0";
$wd1=(strlen($wd1)>50)?substr($wd1,0,50)." ":"$wd1";
$wd2=(strlen($wd2)>50)?substr($wd2,0,50)." ":"$wd2";
$wd3=(strlen($wd3)>50)?substr($wd3,0,50)." ":"$wd3";
$wd4=(strlen($wd4)>50)?substr($wd4,0,50)." ":"$wd4";
$wd5=(strlen($wd5)>50)?substr($wd5,0,50)." ":"$wd5";
$wd6=(strlen($wd6)>50)?substr($wd6,0,50)." ":"$wd6";
$wd7=(strlen($wd7)>50)?substr($wd7,0,50)." ":"$wd7";
$wd8=(strlen($wd8)>50)?substr($wd8,0,50)." ":"$wd8";
$wd9=(strlen($wd9)>50)?substr($wd9,0,50)." ":"$wd9";
$wd10=(strlen($wd10)>50)?substr($wd10,0,50)." ":"$wd10";
$wd11=(strlen($wd11)>50)?substr($wd11,0,50)." ":"$wd11";
$wd12=(strlen($wd12)>50)?substr($wd12,0,50)." ":"$wd12";
$wd13=(strlen($wd13)>50)?substr($wd13,0,50)." ":"$wd13";
$wd14=(strlen($wd14)>50)?substr($wd14,0,50)." ":"$wd14";
$wd15=(strlen($wd15)>50)?substr($wd15,0,50)." ":"$wd15";
$wd16=(strlen($wd16)>50)?substr($wd16,0,50)." ":"$wd16";
$wd17=(strlen($wd17)>50)?substr($wd17,0,50)." ":"$wd17";
$wd18=(strlen($wd18)>50)?substr($wd18,0,50)." ":"$wd18";
$wd19=(strlen($wd19)>50)?substr($wd19,0,50)." ":"$wd19";
$wd20=(strlen($wd20)>50)?substr($wd20,0,50)." ":"$wd20";
echo"$wd0 $wd1 $wd2 $wd3 $wd4 $wd5 $wd6 $wd7 $wd8 $wd9 $wd10 $wd11 $wd12 $wd13 $wd14 $wd15 $wd16 $wd17 $wd18 $wd19 $wd20";
There must be an easier way, surely?