I use similar_text to find which string have the highest similar value to the input
I tried using rsort
to get the highest value, but how do I get string which have the highest value?
$similarities = [];
$input = "makanan daerah";
$type = array('pakaian','senjata','makanan', 'tarian');
foreach ($type as $value) {
similar_text($input, $value, $percent);
$similarities[$value] = $percent;
}
rsort($similarities);
echo($similarities[0]);
I expect output makanan
but the only output I can display is the percent value 66.6667