Posted by: raju161 August 16, 2010
Need help with php code...any insight..
Login in to Rate this Post:     0       ?        
I think you need to modify all of your codes. It's a mess. The thing is simple but you are making it hard
OK fallow what i say...
Use: str_split("$word");   - This will split each letter of the words into arrays
now after tha,t split each letter of the word into arrays and make one to one letter comparisons. It is better to check if a letter exist in a word with a built in function: substr_count($word,$letterEntered); if it exists and the position matches: return value=true; else false and,
to store the letter that have been entered previously, it is better to use cookies instead of Sessions.
To check whether the letter had been entered before, it is easy to call cookie and then check the values stored in it.

Read Full Discussion Thread for this article