Function : limitChars

This function is used to limit the number of characters acceptable in a text string and appends an ellipses to strings that have beyond the acceptable length of texts. A little correctional or adjustment level is also made before ellipses are appended to strings that have beyond the acceptable length of characters

Syntax
  limitChars($text, $max)
   
  $text : supplied text string
  $max  : adjusted maximum number of characters to return. 
   
                  
Sample
  $text = 'This is a string of not more than 10 texts';

  $text = limitChars($text, 22); 

  var_dump( $text ); 
                  
The result is shown below:
  This is a string of not...
                  
In the above, although 22 characters should stop at of no..., however, due to some little internal adjustments, the limitChars() function will smartly adjust the last character to find a form of meaning. This is the reason why the last character t was appended to form of not.... This behaviour is not predictable but it is majorly determined based on the number of characters left to form a word.