本文整理汇总了PHP中Strings::getSimilar方法的典型用法代码示例。如果您正苦于以下问题:PHP Strings::getSimilar方法的具体用法?PHP Strings::getSimilar怎么用?PHP Strings::getSimilar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strings
的用法示例。
在下文中一共展示了Strings::getSimilar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array_keys
<?php
namespace Transvision;
// RTL support
$direction1 = RTLSupport::getDirection($source_locale);
$direction2 = RTLSupport::getDirection($locale);
if ($url['path'] == '3locales') {
$direction3 = RTLSupport::getDirection($locale2);
$extra_column_header = "<th>{$locale2}</th>";
} else {
$extra_column_header = '';
}
$entities = ShowResults::searchEntities($tmx_source, $search->getRegex());
// Display a search hint for the closest string we have if we have no search results
if (count($entities) == 0) {
$merged_strings = [];
$best_matches = Strings::getSimilar($initial_search, array_keys($tmx_source), 3);
include VIEWS . 'results_similar.php';
return;
}
示例2: strtolower
// We have results, we won't display search suggestions but search results
$search_yields_results = true;
$search_id = strtolower(str_replace('-', '', $key));
$message_count = $real_search_results > $limit_results ? "<span class=\"results_count_{$search_id}\">{$limit_results} results</span> out of {$real_search_results}" : "<span class=\"results_count_{$search_id}\">" . Utils::pluralize(count($search_results), 'result') . '</span>';
$output[$key] = "<h2>Displaying {$message_count} for the string " . "<span class=\"searchedTerm\">{$initial_search_decoded}</span> in {$key}:</h2>";
$output[$key] .= ShowResults::resultsTable($search_id, $search_results, $initial_search, $source_locale, $locale, $check);
} else {
$output[$key] = "<h2>No matching results for the string " . "<span class=\"searchedTerm\">{$initial_search_decoded}</span>" . " for the locale {$key}</h2>";
}
}
// Remove duplicated components
$components = array_unique($components);
// Display a search hint for the closest string we have if we have no search results
if (!$search_yields_results) {
$merged_strings = [];
foreach ($data as $key => $values) {
$merged_strings = array_merge($merged_strings, array_values($values));
}
$best_matches = Strings::getSimilar($initial_search, $merged_strings, 3);
include VIEWS . 'results_similar.php';
return;
} else {
if (in_array($check['repo'], $desktop_repos)) {
// Build logic to filter components
$javascript_include[] = '/js/component_filter.js';
$filter_block = '';
foreach ($components as $value) {
$filter_block .= " <a href='#{$value}' id='{$value}' class='filter'>{$value}</a>";
}
}
}