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: Geoff Berrow <blthecat@ckdog.co.uk>
Date: Sat Dec 31 2005 - 11:28:57 CET

Message-ID: <HWstf.630$i%4.305@trndny08> from Lüpher Cypher contained
the following:

>Shorter :)
>
>function trancate($string,$length) {
> $string = substr(trim($string),0,$length);
> $string = substr($string,0,strrpos(trim($string)," "));
> return "$string...";
>}

ahhhh, strrpos() Not used that one before.

-- 
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Received on Tue Jan 3 03:50:49 2006