This is my code:
$val1 = 0; $val2 = 3; $cond = '>';
$check = $val1.$cond.$val2;
echo eval('return $check;') ? 'true' : 'false';
I have a function that, using received parameters, is generating dynamic if statements.
All the statements are generated without errors.
The above code is an example of the code used in said function.
The problem is that all statements return TRUE.
I am sure that I am using eval in a wrong way, but I cannot figure out how.
Aucun commentaire:
Enregistrer un commentaire