note 61743 modified in function.wordwrap by thiago
| From: | thiago@php.net | Date: | Mon, 18 Aug 2008 17:27:51 +0000 |
| Subject: | note 61743 modified in function.wordwrap by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143603@lists.php.net to get a copy of this message | ||
I found this function helpful to cut long words without adding spaces:
<?php
function fWrap ( $vText, $vMax ) {
$vWords = explode(" ", $vText);
foreach ( $vWords as $i =>$w ) {
if ( strlen ( $vWords[$i] ) > $vMax ) { $vWords[$i] = wordwrap( $vWords[$i], $vMax,
"<wbr>", 1 ); }
}
return implode(" ", $vWords);
}
?>
Regards.
--was--
I found this function helpful to cut long words without adding spaces:
function fWrap ( $vText, $vMax ) {
$vWords = explode(" ", $vText);
foreach ( $vWords as $i =>$w ) {
if ( strlen ( $vWords[$i] ) > $vMax ) { $vWords[$i] = wordwrap( $vWords[$i], $vMax,
"<wbr>", 1 ); }
}
return implode(" ", $vWords);
}
Regards.
http://php.net/manual/en/function.wordwrap.php