Re: PHP Tokenize a String by its length
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: PHP Tokenize a String by its length

From: Chung Leong <chernyshevsky@hotmail.com>
Date: Sun Jan 01 2006 - 03:38:43 CET

I usually use a regular expression so that I'm not breaking in the
middle of a word:

preg_match('/^.{0,400}\b/s', $text, $m);
$text_shorten = $m[0];
Received on Tue Jan 3 03:51:24 2006