I have a form that compares 1 word with many and outputs a list of levenshtein scores. How can I get those scores so they list in order, smallest levenshtein score 1st:
<?php
$string5 = $_POST["singleword"];
$string6 = $_POST["manywords"];
$array6 = explode(', ',$string6);
foreach ($array6 as $derp)
{
echo $string5, "/", $derp, ": ", levenshtein($string5, $derp), "<br>";
}
?>
The list outputted would be like this:
apple/mango: 5
apple/peach: 5
apple/toothpaste: 8
apple/apes: 3
I want it to be like this:
apple/apes: 3
apple/mango: 5
apple/peach: 5
apple/toothpaste: 8