View Single Post
11-03-2008, 08:06 PM
#4
Geert is offline Geert
Geert's Avatar
Status: Junior Member
Join date: Mar 2005
Location: Belgium
Expertise:
Software:
 
Posts: 67
iTrader: 0 / 0%
 

Geert is on a distinguished road

Send a message via Skype™ to Geert

  Old

Originally Posted by enigma View Post
$text = substr($title,0,100);

Note that substr() is not UTF-8 compatible and can screw up non-ascii characters. Instead use mb_substr().

And if you are interested in a function that will preserve full words, I created text::limit_chars() for Kohana long time ago: http://dev.kohanaphp.com/browser/tru...p?rev=3366#L40