Oct 21
2005
2005
Here is the UTF-8 version:
Note:
If the string is UTF-8 encoded, 1 Chinese Character is with length 3 if using PHP strlen().
If the string is GB encoded, 1 Chinese Character is with length 2 if using PHP strlen().
For example:
$str = “Hello你好么”;
print utf8_strlen2($str); // print 8
utf8_substr2($str, 0, 6); // print “Hello你”
/***********Start of Code ***************/
function utf8_substr2($str,$start) {


Recent Comments