Truncate long text with PHP (excerpt function)

Truncate is a handy function which can truncate a long text into specific length string and adds elipsis (…) after it. This is an example of how the function “truncate($text,47)” works : function truncate ($str, $length=10, $trailing=’…’) { /* ** $str -String to truncate ** $length – length to truncate ** $trailing – the trailing …