$county="大中华区";
 
 echo "<font color='red'>".$ci=iconv_strlen($county,"UTF-8")."</font>";
     for($j=0;$j<$ci;$j++){
    echo  $e.=iconv_substr($county,$j,$j);
 }

解决方案 »

  1.   


    <?php
    /****************************
     * subCNchar() 截取汉字 *
     * [$str]     [要截取的字符串]
     * [$start]   [截取的起始位置]
     * [$length]  [要截取的长度]
     * [$charset] [字符串编码]
     ****************************/
    function subCNchar($str, $start = 0, $length, $charset = "utf-8") {
    if (strlen($str) <= $length)
    return $str; $re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/";
    $re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/";
    $re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/";
    $re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/";
    preg_match_all($re[$charset], $str, $match); $slice = join("", array_slice($match[0], $start, $length)); return $slice;
    }
    $county="大中华区";
    $res=subCNchar($county,0,1);
    echo $res;
    #大 
    ?>
      

  2.   

    mb_substr,去Php.net看看mb系列就知道了。
      

  3.   





    [User:root Time:19:21:36 Path:/home/liangdong/php]$ cat mb.php 
    <?php
    /* file-encoding : utf-8*/
    /* export LANG=zh_CN.utf-8*/$str = "大中华区";
    $len = mb_strlen($str, "utf-8");
    for ($i = 0; $i != $len; ++ $i) {
            $letter = mb_substr($str, $i, 1, "utf-8");
            echo $letter . PHP_EOL;
    }
    ?>
      

  4.   

     $county="大中华区";
    $array=str_split($county,2);array(4) {
      [0] =>
      string(2) "大"
      [1] =>
      string(2) "中"
      [2] =>
      string(2) "华"
      [3] =>
      string(2) "区"
    }
      

  5.   

    后来使用了一个 iconv_substr