note 60520 added to function.wordwrap

From: Date: Tue, 10 Jan 2006 04:19:15 +0000
Subject: note 60520 added to function.wordwrap
Groups: php.notes 
Request: Send a blank email to php-notes+get-101475@lists.php.net to get a copy of this message
This function wraps a string with the characters count specified: static function cortarCaracteres($sText, $iCharsCount, $sCutWith = "...") { $sTextLength = strlen($sText); if($sTextLength <= $iCharsCount) { return $sText; } if($sTextLength+strlen($sCutWith) > $iCharsCount) { return substr($sText, 0, $iCharsCount-strlen($sCutWith)).$sCutWith; } $iLeftOverChars = strlen($sCutWith) - ($sTextLength - $iCharsCount); return substr($sText, 0, $sTextLength-$iLeftOverChars).$sCutWith; } Regards! ---- Manual Page -- http://www.php.net/manual/en/function.wordwrap.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60520 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60520&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60520&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60520&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60520&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60520&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60520&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60520&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60520&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101475) next »