Create human verification for wordpress contact form with two random number [closed]

Recommend you just stick to * and +, not expect people to deal with decimals and negative numbers. It is best to keep it simple as possible and not attempt to eval the string as an expression which is not good practice:

$operators = array('+', '*');
$operator = rand(0, 1);
$display = $number1.' '.$operators[$operator].' '.$number2;
if ($operators[$operator] == "*") {$result = $number1 * $number2;}
elseif ($operators[$operator] == "+") {$result = $number1 + $number2;}

Of course there are other ways to calculate without eval, such as in this answer, but probably not worth it unless you are doing something more complex.