php+正則將字符串中的字母數(shù)字和中文分割

字號(hào):


    如:$str="php如何將字 符串中322的字母數(shù)字sf f45d和中文_分割?";按數(shù)字或字母分割。
    代碼如下:
    $str = "php如何將字 符串中322的字母數(shù)字Asf f45d和中文_分割?";
    $arr = preg_split("/([a-zA-Z0-9]+)/", $str, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); 
    print_r($arr);
    結(jié)果
    代碼如下:
    $new = array();
    $new[0]="php";
    $new[1]="如何將字 符串中";
    $new[2]="322";
    $new[3]="的字母數(shù)字";
    $new[4]="sf";
    $new[5]=" ";
    $new[6]="f45d";
    $new[7]="和中文_分割?";