array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ru', ), 'this' => array ( 0 => 'function.enchant-dict-quick-check.php', 1 => 'enchant_dict_quick_check', ), 'up' => array ( 0 => 'ref.enchant.php', 1 => 'Функции Enchant', ), 'prev' => array ( 0 => 'function.enchant-dict-is-in-session.php', 1 => 'enchant_dict_is_in_session', ), 'next' => array ( 0 => 'function.enchant-dict-store-replacement.php', 1 => 'enchant_dict_store_replacement', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ru', 'path' => 'reference/enchant/functions/enchant-dict-quick-check.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant:0.2.0-1.0.1)
enchant_dict_quick_check — Проверить, правильно ли написано слово и предложить варианты замены
$dictionary
, string $word
, array &$suggestions
= null
): bool
Если слово корректно, то вернёт true
, в ином случае вернёт false
. Если задан параметр
suggestions, то он будет заполнен вариантами замены.
dictionary
Словарь Enchant, который возвращает функция enchant_broker_request_dict() или enchant_broker_request_pwl_dict().
word
Слово для проверки
suggestions
Если проверка провалилась, то эта переменная будет содержать массив с вариантами замены
Версия | Описание |
---|---|
8.0.0 |
Параметр dictionary ожидает экземпляр класса EnchantDictionary;
Раньше параметр ждал ресурс (resource).
|
Пример #1 Пример использования enchant_dict_quick_check()
<?php
$tag = 'en_US';
$r = enchant_broker_init();
if (enchant_broker_dict_exists($r,$tag)) {
$d = enchant_broker_request_dict($r, $tag);
enchant_dict_quick_check($d, 'soong', $suggs);
print_r($suggs);
}
?>
Вывод приведённого примера будет похож на:
Array ( [0] => song [1] => snog [2] => soon [3] => Sang [4] => Sung [5] => sang [6] => sung [7] => sponge [8] => spongy [9] => snag [10] => snug [11] => sonic [12] => sing [13] => songs [14] => Son [15] => Sonja [16] => Synge [17] => son [18] => Sejong [19] => sarong [20] => sooner [21] => Sony [22] => sown [23] => scone [24] => song's )