PHP 8.4.2 Released!

enchant_dict_quick_check

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant:0.2.0-1.0.1)

enchant_dict_quick_checkCheck the word is correctly spelled and provide suggestions

说明

enchant_dict_quick_check(EnchantDictionary $dictionary, string $word, array &$suggestions = null): bool

If the word is correctly spelled return true, otherwise return false, if suggestions variable is provided, fill it with spelling alternatives.

参数

dictionary

An Enchant dictionary returned by enchant_broker_request_dict() or enchant_broker_request_pwl_dict().

word

The word to check

suggestions

If the word is not correctly spelled, this variable will contain an array of suggestions.

返回值

Returns true if the word is correctly spelled or false

更新日志

版本 说明
8.0.0 dictionary expects an EnchantDictionary instance now; previoulsy, a resource was expected.

示例

示例 #1 A enchant_dict_quick_check() example

<?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
)

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top