get_answers(); if ( $answers ) { $correct = true; foreach ( $answers as $key => $option ) { $selected = $this->is_selected_option( $option, $user_answer ); // If the option is FALSE but user selected => WRONG if ( $selected && ! $option->is_true() ) { $correct = false; } elseif ( ! $selected && $option->is_true() ) { // If option is TRUE but user did not select => WRONG $correct = false; } // Only one option is selected wrong if ( ! $correct ) { break; } } if ( $correct ) { $return = array( 'correct' => true, 'mark' => floatval( $this->get_mark() ), ); } } return $return; } } }