Implement in PHP a function:
function AutoCorrectEmailAddress($input)
Where input is a string representing an email address with a valid syntax, which may contain spelling errors. The spelling errors may exists in either the local part (i.e. string before the [at] character) or in the domain part (i.e. string after the [at] character).
The function returns an array with the original input data as the first item, and possible fixed variations of the string as other items.
The actual spell checking works with two methods:
Method 1) Connect to a localhost MySQL database and read table "autocorrect". It contains fields called "input" and "output" where "input" contains a single misspelled word (e.g. "[login to view URL]") and "output" contains a corresponding fixed version of the word (e.g. "[login to view URL]")
Method 2) Use the free Hunspell spell checker system (this probably comes handy: [login to view URL])
Naturally, you must first split the given input string by special characters and numbers and individually spell check all the elements. For example AutoCorrectEmailAddress("[login to view URL][at][login to view URL]") should result in checks to the autocorrect table with input strings such as "eksample", "typoo", "eksample-typoo", "gnail" and "[login to view URL]" and assuming the Methods 1 and 2 return good data, the result of the function should be an array something like this:
"[login to view URL][at][login to view URL]"
"[login to view URL][at][login to view URL]"
"[login to view URL][at][login to view URL]"
"[login to view URL][at][login to view URL]"
"[login to view URL][at][login to view URL]"
"[login to view URL][at][login to view URL]"
"[login to view URL][at][login to view URL]"
"[login to view URL][at][login to view URL]"
"[login to view URL][at][login to view URL]"
As you can see, the result array must contain all the possible combinations of the given email address with the spell corrected elements.
You are not given any server access or the full "autocorrect" db table. You must use your own test server for the development, and your own sample "autocorrect" db table for the testing of this PHP function.