像這樣:
abcde1234 轉(zhuǎn)成 abcd 1234
小白求助...
閉關(guān)修行中......
簡單 正則搞定
<?php
$str = "abcde1234";
preg_match('/^(\w+)e(\d+)$/i',$str,$matches);
print_r ($matches);
Array
(
[0] => abcde1234
[1] => abcd
[2] => 1234
)
explode()函數(shù) http://www.w3school.com.cn/php/func_string_explode.asp
<?php
$str = "abcde1234";
print_r (explode("e",$str));
Array (
[0] => abcd
[1] => 1234
)
在線演示:http://3v4l.org/k7Dap