Documentation

Captcha


The captcha helper provides a simple math captcha:


Methods


getMathQuestion()


Creates the question from random variables, which are also saved to the session.



correctAnswer(integer $answer)


Checks the given answer if it matches the addition of the saved session variables.


if (isset($_POST['submit'])) {
    if (Captcha::correctAnswer($_POST['answer'])) {
        // Do something...
    }
}