Function : limitText

This function is used to limit the size of a words in a string based on the number of words desired. Longer texts are appended with ellipses.

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

  $text = limitText($text, 7); 

  var_dump( $text ); 
                  
The result is shown below:
  This is a string of not more ...