adding captcha in a php file

Hi!
I am using a premium theme at themeforest.
I want to add captcha in the contact form

The code in the contact form is:
// Check to see if sum has been correctly answered
if(trim($_POST['verify']) !== '4') {
$verifyError = true;
$hasError = true;

so I want an external captcha that will affect the value of verifyError

sorry for being new to php
any hints for me? :slight_smile: