我在while循环中使用了like_text:
while ($row = mysql_fetch_array($result)) {
$similiar_name = $row["f_name"];
similar_text($prototype_name, $similiar_name, $percent);
}
我如何回应最高的百分比?
答案 0 :(得分:2)
将计算结果存储在数组中,然后对该数组进行排序并提取最高结果
$similarities = [];
while ($row = mysql_fetch_array($result)) {
$similiar_name = $row["f_name"];
similar_text($prototype_name, $similiar_name, $percent);
$similarities[$similiar_name] = $percent;
}
rsort($similarities);
echo $similarities[0];