public function testAction()
{
$str = 'Hello123Worldabc';
$rankstr = $this->preg_substr('/\d+/', '/abc/', $str);
echo $rankstr."<br>";
}
private function preg_substr($start, $end, $str){
$temp = preg_split($start, $str);
var_dump($temp);
if(isset($temp[1])){
$content = preg_split($end, $temp[1]);
var_dump($content);
return $content[0];
}
return false;
}
返回
array(2) {
[0]=>
string(5) "Hello"
[1]=>
string(8) "Worldabc"
}
array(2) {
[0]=>
string(5) "World"
[1]=>
string(0) ""
}
World<br>