I am making a code that matches up a word ($word) with a selection of definitions ($word_defs). However no matter which definition is matched up with the word chosen at random, the response after the user’s guess is always incorrect. How can i fix this code?
Outside Entry Code:
[code]require_once “include/word_defs.php”;
$word = array_keys($word_defs);
$word_defs = array_unique(array_values($word_defs));
$params = (object) $_REQUEST;
$session = new Session();
if (isset($params->guess)) {
$word = $params->word;
if ( $params->word_defs == $word_defs[$word] ) {
$response = “correct”;
} else {
$response = “incorrect”;
}
$choices->word_def[$params->word_defs] = “selected”;
} else {
$word = $word[ rand( 0, count($word)-1 ) ];
}[/code]