preg_match在以下
上工作正常function percentageExt($text){
preg_match_all("/[0-9 ]+%/", $text, $matches);
return $matches;
}
$string = "Tools Minimum 20 % off and in maximum 25% off";
$extracted = percentageExt($string);
print_r($extracted);
但是如果在while循环中实现相同的话,则不起作用
function percentageExt($text){
preg_match_all("/[0-9 ]+%/", $text, $matches);
return $matches;
}
$query = mysql_query("select title from deals");
while($query_rows = mysql_fetch_array($query)){
$extracted = percentageExt($query_rows['title']);
print_r($extracted);
}
请提出我承诺的常见错误。