如何以数字为界限,将字符串分别存入到数组里面!@ 例如:阿飞了哈34asogh倒萨存入数组为:a[0] = '阿飞了哈'a[1] = 'asogh倒萨' 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var_dump(preg_split ("/\d/", "阿飞了哈34asogh倒萨",-1,PREG_SPLIT_NO_EMPTY)); 上面的正则挺好,我没那么厉害,不过我会其他的,判断字符,如果用integer转化后不等于0就加个符号作为标识,然后再explode('标识', $字符串); 这个不错,使用 preg_split 。 //我也来个$str='阿飞了哈34asogh倒萨';preg_match_all('/[^\d]+/i', $str, $matches);var_dump($matches); $a = split('[0-9]+', '阿飞了哈34asogh倒萨');print_r($a);Array ( [0] => 阿飞了哈 [1] => asogh倒萨 ) <?php$s = '阿飞了哈34asogh倒萨';preg_match_all('@[^\d]*(?=\d)|(?<=\d)[^\d]*@i', $s, $matches);print_r($matches);?> nginx目录权限控制求助 Fatal error: Call to undefined function curl_init() in ANSI转utf-8 RewriteRule ^(.*)$ $1.php【可以这样么?】 为什么没定义的变量可以当成字符串输出? 怎么替换一个字符串中间的字符 刚学PHP,一些问题.... 菜鸟求助:提交后,如何得到多选列表中所有的值?——在线等 新手请教:$PHP_SELF这个变量怎么用? 服务器端的PHP代码如何直接操作客户端的文件?有可能吗? 防刷新的问题 求vn700等各大高手!求助PHP正则!
var_dump(preg_split ("/\d/", "阿飞了哈34asogh倒萨",-1,PREG_SPLIT_NO_EMPTY));
判断字符,如果用integer转化后不等于0就加个符号作为标识,
然后再explode('标识', $字符串);
//我也来个
$str='阿飞了哈34asogh倒萨';
preg_match_all('/[^\d]+/i', $str, $matches);
var_dump($matches);
');
print_r($a);Array ( [0] => 阿飞了哈 [1] => asogh倒萨 )
<?php
$s = '阿飞了哈34asogh倒萨';
preg_match_all('@[^\d]*(?=\d)|(?<=\d)[^\d]*@i', $s, $matches);
print_r($matches);
?>