PHP Code:--------------------------------------------------------------------------------
/**
@Author: LAD
@URL: http://www.cnpik.com/
@E_mail: lianxiwoo@sohu.com
@ casual use, no money:-)
*/
function Cnsubstr ($string, $sublen)
{
if ($sublen >=strlen ($string))
{
return $string;
}
$s = "";
for ($i =0; $i < $sublen; $i + +)
{
if (Ord ($string {$i}) >127)
{
$s. = $string {$i}. $string {+ + $i};
Continue
}else{
$s. = $string {$i};
Continue
}
}
return $s;
}//End Function cnsubstr ($string, $sublen)
Use the like this:
echo "
__________________________
";
$string = "242432 Opposition is 456 committed to the extensive embassy place 7890";
$sublen =strlen ($string);
$len = 20;
echo $string. "
";
echo "Total length is:". ($sublen + 1). "
";
echo "Intercept number:". $len. "
";
for ($i =1; $i <= $sublen +1; $i + +) {
if ($i > $len) {
echo $i. " → ". Cnsubstr ($string, $i)." ...
";
Continue
}
echo $i. " → ". Cnsubstr ($string, $i)."
";
}
?>
http://www.bkjia.com/PHPjc/629308.html www.bkjia.com true http://www.bkjia.com/PHPjc/629308.html techarticle PHP code:--------------------------------------------------------------------------------? PHP/** * * * @Author: LAD * * * @URL: a HREF=HTTP://WWW.CNPIK.COM/TARGET=_BLANKHTTP://WWW.CNPI ...