在php中,如果我要把e前和后的字串分割该怎么办?
像这样:
abcde1234 转成 abcd 1234
小白求助...
explode()函数 http://www.w3school.com.cn/php/func_string_explode.asp
<?php
$str = "abcde1234";
print_r (explode("e",$str));
Array (
[0] => abcd
[1] => 1234
)
1 回答4.1k 阅读✓ 已解决
3 回答1.9k 阅读✓ 已解决
2 回答2.3k 阅读✓ 已解决
2 回答793 阅读✓ 已解决
1 回答1.4k 阅读✓ 已解决
2 回答2.3k 阅读
1 回答698 阅读✓ 已解决
简单 正则搞定
<?php
$str = "abcde1234";
preg_match('/^(\w+)e(\d+)$/i',$str,$matches);
print_r ($matches);
Array
(
[0] => abcde1234
[1] => abcd
[2] => 1234
)