O'Reilly logo

Core PHP Programming, Third Edition by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12.7. Spell Checking

PHP offers spell checking through the Pspell library, which is a replacement for the older Aspell library.

integer pspell_add_to_personal(integer configuration, string word)

The pspell_add_to_personal function (Listing 12.73) adds a word to a personal dictionary. You must supply a configuration link as created by pspell_new_config.

Listing 12.73. pspell_add_to_personal
<?php
    //create a configuration link
    $config = pspell_config_create("en");

    //set path to personal words
    pspell_config_personal($config, "/tmp/custom.pws");

    //load dictionary
    $new_config = pspell_new_config($config);

    //add word to dictionary
    pspell_add_to_personal($new_config, "Leon");

    //save personal dictionary
    pspell_save_wordlist($new_config);
?>

integer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required