Chinese intercept 2, single byte intercept mode
function Cn_substr ($str, $slen, $STARTDD =0) {
$restr = "";
$c = "";
$str _len = strlen ($STR);
if ($str _len < $STARTDD + 1) return "";
if ($str _len < $STARTDD + $slen | | $slen ==0) $slen = $str _len-$startdd;
$ENDDD = $STARTDD + $slen-1;
for ($i =0; $i < $str _len; $i + +)
{
if ($STARTDD ==0) $restr. = $c;
else if ($i > $STARTDD) $restr. = $c;
if (Ord ($str [$i]) >0x80) {
if ($str _len> $i + 1) $c = $str [$i]. $str [$i +1];
$i + +;
}
else{$c = $str [$i];}
if ($i >= $enddd) {
if (strlen ($RESTR) +strlen ($c) > $slen) break;
else{$restr. = $c; break;}
}
}
return $restr;
}
function Cn_midstr ($str, $start, $len) {
Return Cn_substr ($str, $slen, $STARTDD);
}
http://www.bkjia.com/PHPjc/318564.html www.bkjia.com true http://www.bkjia.com/PHPjc/318564.html techarticle //Chinese intercept 2, single byte capture mode Functioncn_substr ($str, $slen, $STARTDD =0) {$restr = ""; $c = ""; $str _len=strlen ($STR); if ($str _len$ startdd+1) return ""; if ($str _len$startdd+ $slen | ...