Creates an image with a randomly created simple arithmetic operation as Captcha.
Creates an image with a randomly created simple arithmetic operation as Captcha.
Requires PHP version 7.x
int $maxLow
: The lowest randomly possible numberint $maxHigh
: The lowest randomly possible numberarray $availableOperators
: Addition, Subtraction, Multiplication & Division are supportedstring $fontFile
: Absolute path to a .ttf font file
$captcha = new \CaptchaCalc\CaptchaCalc(3, 15, ['+', '-', '*', '/'], 'absolute/path/to/fontfile.ttf');
$img = $captcha->generateImage();
echo '<img src="$img">';
// Result (Don't show in production environment):
$captcha->calculateResult();