public static function levenshtein($word, $words, $order = SORT_ASC, $sort_flags = SORT_REGULAR)
    {
        foreach ($words as $w) {
            $result[$w] = levenshtein($word, $w);
        }

        if ($order & SORT_DESC) {
            arsort($result, $sort_flags);
        } else {
            asort($result, $sort_flags);
        }

        return $result;
    }
public static function levenshtein($word, $words, $order = SORT_ASC, $sort_flags = SORT_REGULAR)
    {
        foreach ($words as $w) {
            $result[$w] = levenshtein($word, $w);
        }

        if ($order & SORT_DESC) {
            arsort($result, $sort_flags);
        } else {
            asort($result, $sort_flags);
        }

        return $result;
    }
public static function levenshtein ( $ word , $ words , $ order = SORT_ASC , $ sort_flags = SORT_REGULAR ) { foreach ( $ words as $ w ) { $ result [ $ w ] = levenshtein ( $ word , $ w ) ; } if ( $ order & SORT_DESC ) { arsort ( $ result , $ sort_flags ) ; } else { asort ( $ result , $ sort_flags ) ; } return $ result ; }
Sort a words list by their levenshtein distance of word.

@param string   $word
@param string[] $words
@param int      $order
@param int      $sort_flags

@return mixed
Sort a words list by their levenshtein distance of word .