note 81654 added to function.substr
| From: | Anonymous at osu1 dot php dot net | Date: | Sat, 08 Mar 2008 15:38:13 +0000 |
| Subject: | note 81654 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136838@lists.php.net to get a copy of this message | ||
I tried to use the neat script ben contributed, but for Chinese characters. The characters all
finish with a ";" and start with a "&". eg.: 们
So I altered the script to:
function cutText($string, $length) {
while ($string{$length} != ";") {
$length--;
}
return substr($string, 0, $length);
}
But doesn't work properly (tried ; and &), the function still cuts after the original
$length. Any Ideas?
----
Server IP: 217.13.201.10
Probable Submitter: 88.65.76.127
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/81654
Del: integrated -- https://master.php.net/note/delete/81654/integrated
Del: useless -- https://master.php.net/note/delete/81654/useless
Del: bad code -- https://master.php.net/note/delete/81654/bad+code
Del: spam -- https://master.php.net/note/delete/81654/spam
Del: non-english -- https://master.php.net/note/delete/81654/non-english
Del: in docs -- https://master.php.net/note/delete/81654/in+docs
Del: other reasons-- https://master.php.net/note/delete/81654
Reject -- https://master.php.net/note/reject/81654
Search -- https://master.php.net/manage/user-notes.php