PHP code example of magkopian / php-math-captcha

1. Go to this page and download the library: Download magkopian/php-math-captcha library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

magkopian / php-math-captcha example snippets


session_start();

$mathCaptcha = new MathCaptcha\MathCaptcha();

$mathCaptcha->generate();
$mathCaptcha->output();

session_start();

$mathCaptcha = new MathCaptcha\MathCaptcha();

if ( $mathCaptcha->check($captcha_answer) === true ) {
	// Correct answer
}
else {
	// Incorrect answer
}