PHP/String/similar text — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 10:37, 26 мая 2010
Checking for Similar Names
<?php
$names = array("A", "B","R", "R");
$output = "";
foreach ($names as $name) {
similar_text($name, "Roberto Smyth", $percent);
$output .= "{$name} = {$percent}%\n";
}
echo "<pre>{$output}</pre>";
?>
Determine the similarity between two strings is provided by the similar_text function
<?php
$matches = similar_text ("see", "say", &$per);
echo "Matches: $matches - Percentage: $per\n";
?>