/*
                    var count = {};
                    var strArr = [];
                    var oddCounter = 0;
                    var objKeys = [];
                    var splitString;
                    var reverseArray;
                    var joinArray;
                    var url = "test-spelling.php";
                    var someRes = "";
                    
                    var mForN = function(obj, strArr) {
                      for (var y = 0; y < strArr.length; y++) {
                        // console.log("obj[strArr[" + y + "]]: " + obj[strArr[y]]);
                        if (isset(obj[strArr[y]])) {
                          obj[strArr[y]]++;
                        } else {
                          obj[strArr[y]] = 1;
                        }
                      }
                      return obj;
                    };
                    
                    var mForN_2 = function(obj, objKeys) {
                      for (var z = 0; z < objKeys.length; z++) {
                        /* console.log(
                          "obj[objKeys[z]]: " +
                            obj[objKeys[z]] +
                            " obj[objKeys[z]] % 2: " +
                            eval(obj[objKeys[z]] % 2)
                        ); */
                        if (eval(obj[objKeys[z]] % 2) == 1) {
                          oddCounter++;
                        }
                        // console.log("oddCounter: " + oddCounter);
                      }
                    
                      return oddCounter <= 1;
                    };
                    
                    var isset = function(obj) {
                      if (typeof obj === "undefined" || obj === null) {
                        return false;
                      } else {
                        return true;
                      }
                    };
                    
                    var isPalindrom = function(str) {
                      // reverse original string
                      splitString = str.split("");
                      reverseArray = splitString.reverse();
                      joinArray = reverseArray.join("");
                    
                      var checking = checkSpellingOfStr(str);
                    
                      if (str == joinArray) {
                        strArr = str.split("");
                        // console.log("strArr: " + strArr);
                    
                        objKeys = makeObjKeys(count, strArr);
                        // console.log("filled count before mForN: " + JSON.stringify(count));
                    
                        // create array of keys in the count object
                        objKeys = Object.keys(count);
                        // console.log("objKeys: " + objKeys);
                    
                        count = mForN(count, strArr);
                        // console.log("count after mForN: " + JSON.stringify(count));
                    
                        return mForN_2(count, objKeys);
                      } else {
                        return 0;
                      }
                    };
                    
                    var makeObjKeys = function(obj, arr) {
                      for (var x = 0; x < arr.length; x++) {
                        obj[arr[x]] = null;
                      }
                      return obj;
                    };
                    
                    var checkSpellingOfStr = function(someStr) {
                      var formData = {
                        someWord: someStr
                      };
                    
                      $.ajax({
                        type: "GET",
                        url: url,
                        data: formData,
                        success: function(result) {
                          if (!$.trim(result)) {
                          } else {
                            console.log(result);
                            $("#checkSpelling").html(result);
                          }
                        }
                      });
                    };
                    
                    */
                
              
                  <?php
                  error_reporting(E_ALL); 
                  ini_set('display_errors', 1);

                  if(!empty($_REQUEST['someWord']))
                  {
                      $someWord = $_REQUEST['someWord'];
                  }

                  $pspell_link = pspell_new("en");

                  if (pspell_check($pspell_link, $someWord)) {
                    echo trim($someWord) . " is a recognized word in the English language";
                  } else {
                    echo "Your word is either misspelled or that is not a recognized word";
                  }