I'm very sorry to dissapoint you, but I spent few hours last evening looking at this and didn't come up with a solution... 🙁
The whole thing goes around this
I have a coupe of forms, and a lot of variables to get validated.
So I put them in a database - not to get lost among them
If $variableX_validated comes up false then the whole form will not go on and fieldX (in form) will go class="error"
It may be that I'm on a wrong track alltogether, but... I got kinda stuck here (I could just write all those validations, but this seems more... elegant?)
alas...
for ($i=0; $i<4; $i++){
//create the label of the variable;
$var_label_string = "var$i";
//Now evaluate that string as if it were a variable !;
$value_of_that_var = ${$var_label_string};
//now find out if that var is equal to "dog";
if ($value_of_that_var == "dog"){
print "Dog found here: $var_label_string";
}
}
do I have to do it in 2 steps?
like:
$validator = "variable$i_validated"
$var = "variable$i"
${$validator} = validate_as_letters(${$var})
what am I doing wrong?