Code:
$result= 'the answer';
return $result;
That is always going to validate. The IF condition is a simple if ( $CODE_RETURN_VALUE ). Since you're returning a value other than false, null, or 0 it's going to validate as valid.
Code:
$result = false;
return $result;
That is always going to be invalid since you're always returning false UNLESS the field is marked not required and no value has been supplied. I have already tested this on our demo site and it works perfectly fine.
I don't know what more to tell you. It's a simple FALSE if you want to invalidate the input or TRUE if you want to validate it. Your code should do whatever PHP validation you want and it should then do a return of true or false. Do not return anything other than true or false. The parameter specifically tells you this.
Please PM backend super administrator login credentials and will prepare test cases on your site for you to see it working for your self.