Function : limitWord

This function is used to limit the number of characters acceptable in any given text string. It uses a 5 character correctional count to determine how texts are trimmed.

Syntax
  limitWord($text, $max)
   
  $text : supplied text string
  $max  : adjusted maximum number of characters to return. 
   
                  
Assuming a maximum character length of 4 is supplied on a string, the maximum acceptable number of character will be 9 (i.e 4+5) due to an adjusted 5 character increase added by default. Hence, the limitWord() function will assume that a maximum number of "9" characters is expected to be returned. This means that any text after a character length 9 will be truncated. However, the limitWord also projects that each word should never be broken apart. In the event that the last word was broken due to longer length, then limitChar() will also truncate the last word so as to avoid breaking it apart
Sample : limitWord
  $text = 'This is a string of not more than 10 words';

  $text = limitWord($text, 8); // max 13 (i.e 8+5) 

  var_dump( $text ); 
                  
String of 13 characters
  This is a str...
                  
However, limitWord() does not support breaking words apart. Due to this reason, the last word "str" that was split from "string" will also be truncated. Hence the final result will be :
Final output
  This is a ...