您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

C_substr

2025/9/29 17:26:00发布15次查看
//用法与substr函数一样
function c_substr($str,$start=0) {
  $ch = chr(127);
  $p = array(/[\x81-\xfe]([\x81-\xfe]|[\x40-\xfe])/,/[\x01-\x77]/);
  $r = array(,);
  if(func_num_args() > 2)
    $end = func_get_arg(2);
  else
    $end = strlen($str);
  if($start     $start += $end;
  if($start > 0) {
    $s = substr($str,0,$start);
    if($s[strlen($s)-1] > $ch) {
      $s = preg_replace($p,$r,$s);
    $start += strlen($s);
    }
  }
  $s = substr($str,$start,$end);
  $end = strlen($s);
  if($s[$end-1] > $ch) {
    $s = preg_replace($p,$r,$s);
    $end += strlen($s);
  }
  return substr($str,$start,$end);
}
?>
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product