character_limiter($str[, $n = 500[, $end_char = '…']])
Parameters: |
|
---|---|
Returns: |
Character-limited string |
Return type: |
string |
Truncates a string to the number of characters specified. It maintains the integrity of words so the character count may be slightly more or less than what you specify.
Example:
$string = "Here is a nice text string consisting of eleven words."; $string = character_limiter($string, 20); // Returns: Here is a nice text string
The third parameter is an optional suffix added to the string, if undeclared this helper uses an ellipsis.
Note
If you need to truncate to an exact number of characters please see the ellipsize()
function below.
Please login to continue.