note 28587 deleted from function.substr by aidan
| From: | aidan@php.net | Date: | Sat, 03 Jul 2004 07:46:55 +0000 |
| Subject: | note 28587 deleted from function.substr by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72374@lists.php.net to get a copy of this message | ||
Note Submitter: arne.hartherz@gmx.net
----
if you want to cut strings, but don't want them to be interrupted right in the middle of a
word, this function might help:
function cutstr ($string, $len) {
$i = $len;
while ($i < strlen($string)) {
if ($string[$i] == " ") {
$string = substr($string, 0, $i)."[...]";
return $string;
}
$i++;
}
return $string;
}