$str = "abcdef啊啊吧啊";function my_sub($str, $st ,$len){ $ret = "";
for( $st; $len > 0; $st++){
$cStr = $str[$st];
if( ord( $cStr ) > 127 ){
$cStr = substr($str, $st, 3);
$st += 2;
}
$len -= 1;
$ret .= $cStr;
}
return $ret;
} echo my_sub($str, 3, 6);
$str = "abcdef啊啊吧啊";function my_sub($str, $st ,$len){ $ret = "";
for( $st; $len > 0; $st++){
$cStr = $str[$st];
if( ord( $cStr ) > 127 ){
$cStr = substr($str, $st, 3);
$st += 2;
}
$len -= 1;
$ret .= $cStr;
}
return $ret;
} echo my_sub($str, 3, 6);
该资源仅限VIP专享下载