PHP 把字符串转换为数组支持中文
<meta charset="UTF-8"> <?php //将一个字符串转换成数组,支持中文 function strToArray($string) { $strlen = mb_strlen($string); while ($strlen) { $array[] = mb_substr($string, 0, 1, "utf8"); $string = mb_substr($string, 1, $strlen, "utf8"); $strlen = mb_strlen($string); } return $array; } $string = '链接:www.onestopweb.cn'; $arr = strToArray($string); print_r($arr); ?>
效果图:
相关推荐
lightindark 2020-06-03
baishuwei 2020-06-03
zmjzhangmj 2020-04-20
KilluaZoldyck 2020-01-29
rongxionga 2020-01-20
playlinuxxx 2010-02-22
过儿古墓 2011-01-12
Crazyshark 2019-06-25
amberom 2015-07-01
zhangkala 2013-06-08
cxymds 2019-06-27
静心斋 2013-08-23
dabian 2012-07-06
gmmargin 2012-12-26
张金乙 2012-08-07
WasteLand 2017-09-22
小小时光 2018-04-13
doupoo 2011-05-19
Taicyzhang 2017-07-03