example1.php 648 B

12345678910111213141516171819202122232425
  1. <?php
  2. $tag = 'en_US';
  3. $r = enchant_broker_init();
  4. $bprovides = enchant_broker_describe($r);
  5. echo "Current broker provides the following backend(s):\n";
  6. print_r($bprovides);
  7. if (enchant_broker_dict_exists($r,$tag)) {
  8. $d = enchant_broker_request_dict($r, $tag);
  9. $dprovides = enchant_dict_describe($d);
  10. echo "dictionary $tag provides:\n";
  11. $spellerrors = enchant_dict_check($d, "soong");
  12. print_r($dprovides);
  13. echo "found $spellerrors spell errors\n";
  14. if (spellerrors) {
  15. $suggs = enchant_dict_suggest($d, "soong");
  16. echo "Suggestions for 'soong':";
  17. print_r($suggs);
  18. }
  19. enchant_broker_free_dict($d);
  20. } else {
  21. }
  22. enchant_broker_free($r);
  23. ?>