note 40609 added to function.substr
| From: | forSJISUsers at rn2 dot php dot net | Date: | Tue, 09 Mar 2004 14:28:02 +0000 |
| Subject: | note 40609 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66490@lists.php.net to get a copy of this message | ||
For those who want to SJIS (Japanese Encoding), this function can be used. This function is based on
the function of Windix for UTF-8 users. This function was very helpful for me. Thank you, Windix!
function sjis_substr($str,$start) {
preg_match_all(
"/[\x81-\x9f][\x40-\xfc]|[\xe0-\xfc]
[\x40-\xfc]|[\xa1-\xdf]|[\x01-\x7f]/", $str, $ar);
if(func_num_args() >= 3) {
$end = func_get_arg(2);
return join("",array_slice($ar[0],$start,$end));
} else {
return join("",array_slice($ar[0],$start));
}
return $str;
}
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40609
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40609&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40609&report=yes
Search -- http://master.php.net/manage/user-notes.php