范文 |
如:$str=php如何将字 符串中322的字母数字sf f45d和中文_分割?;按数字或字母分割。 代码如下: $str = php如何将字 符串中322的字母数字asf f45d和中文_分割?; $arr = preg_split(/([a-za-z0-9]+)/, $str, 0, preg_split_no_empty | preg_split_delim_capture); print_r($arr); 结果 代码如下: $new = array(); $new[0]=php; $new[1]=如何将字 符串中; $new[2]=322; $new[3]=的字母数字; $new[4]=sf; $new[5]= ; $new[6]=f45d; $new[7]=和中文_分割?; |