php8.5
Home/ Manual/ pspell / functions/ pspell_suggest

pspell_suggest

PHP function Edit on GitHub ✎

(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)

Suggest spellings of a word

Description

pspell_suggest(PSpell\Dictionary $dictionary, string $word): array|false

pspell_suggest() returns an array of possible spellings for the given word.

Parameters

dictionary

Pspell-dictionary

word

The tested word.

Return Values

Returns an array of possible spellings.

Changelog

VersionDescription

Examples

pspell_suggest() example

php
<?php
$pspell = pspell_new("en");

if (!pspell_check($pspell, "testt")) {
    $suggestions = pspell_suggest($pspell, "testt");

    foreach ($suggestions as $suggestion) {
        echo "Possible spelling: $suggestion<br />";
    }
}
?>

Source: reference/pspell/functions/pspell-suggest.xml · from the official PHP manual (php/doc-en)