[Php 4> = 4.0.2, Php 5, Php 7, Php 8]
pspell_check - kiểm tra một từ — Check a word
Sự mô tả
pspell_check [] kiểm tra chính tả của một từ. checks the spelling of a word.
Trả về giá trị
Trả về true
nếu chính tả là chính xác, false
nếu không.true
if the spelling is correct,
false
if not.
Thay đổi
8.1.0 | pspell_check [] kiểm tra chính tả của một từ.PSpell\Dictionary instance now; previously, a resource was expected. |
Trả về giá trị
Trả về true
nếu chính tả là chính xác, false
nếu không.pspell_check[] Example
Thay đổi ¶
Phiên bản
I felt that it would help to expand on batch spell checking using this function. The previously posted example implodes using spaces as the separator for each word. There are however situations in which doing this will not return the desired result. For example, "Hello, I like coding." will return an array with two problems, "Hello," and "coding.", both these words are spelt correctly, but pspell_check[] will deem them as spelled incorrectly because a comma or a period is being passed in to the function along with the word. The following example allows you to extract only the words [using regular expressions to ignore grammar such as periods or commas] in to an array and then add in html font tags to highlight all words spelled incorrectly red before returning the string.