我怎样才能获得23的,而不是1对$lastnum1?
$text = "1 out of 23";
$lastnum1 = $this->getEval(eregi_replace("[^* out of]", '', $text));
Run Code Online (Sandbox Code Playgroud)
Div*_*com 23
你可以这样做:
$text = "1 out of 23";
if(preg_match_all('/\d+/', $text, $numbers))
$lastnum = end($numbers[0]);
Run Code Online (Sandbox Code Playgroud)