note 28585 deleted from function.substr by victor
| From: | victor@php.net | Date: | Fri, 17 Jan 2003 13:57:40 +0000 |
| Subject: | note 28585 deleted from function.substr by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42274@lists.php.net to get a copy of this message | ||
you might want to cut a string, but don't want it to be interrupted right in the middle of a
word.
this function could help:
function cutstr ($string, $len) {
$i = $len;
while ($i < strlen($string)) {
if ($string[$i] == " ") {
$string = substr($string, 0, $i)."[...]";
return $string;
}
$i++;
}
return $string;
}