php正则提取文本中多个11位国内手机号完整实例

php正则提取文本中多个11位国内手机号完整实例



 * @copyright www.echafen.com
 * @version 2.5 2017-08-28
 */

function chafenbacom($str){
$mobis = "提取到:";
preg_match_all('/1[34578][0-9]{8,10}/', $str, $match);
foreach($match[0] as $mobi1){ 
$mobis .= $mobi1."+";
} 
return $mobis;//得结果,可输出查看或调用
}


//调用
$str="我的手机号是13888888888,或者13999999999,订单号12345678910防伪号123123456789喜欢哪个?";
echo chafenbacom($str);
?>


你可能感兴趣的:(php)