php提取字符串中的数字
function findNum($str=''){
$str=trim($str);
if(empty($str)){
return '';
}
$temp=array('1','2','3','4','5','6','7','8','9','0');
$result='';
for($i=0;$i<strlen($str);$i++){
if(in_array($str[$i],$temp)){
$result.=$str[$i];
}
}
return $result;
}
本文来自博客园,作者:小ྀ青ྀ年້,转载请注明原文链接:https://www.cnblogs.com/dalaowang/p/10735046.html

浙公网安备 33010602011771号