note 22623 deleted from function.substr by aidan

From: Date: Sat, 03 Jul 2004 07:53:50 +0000
Subject: note 22623 deleted from function.substr by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72387@lists.php.net to get a copy of this message
Note Submitter: hwlab@cs.teiher.gr ---- How to make a nice trim of text without break words in the middle : $maxTextLenght=125; $aspace=" "; if(strlen($text) > $maxTextLenght ) { $text = substr(trim($text),0,$maxTextLenght); $text = substr($text,0,strlen($text)-strpos(strrev($text),$aspace)); $text = $text.'...'; }

« previous php.notes (#72387) next »