jeudi 23 mai 2019

How to check if condition defined as variable in php?

I have one variable which contains the condition dynamically and I need to check that condition. For example, $condition = '21 < 20'; if($condition){ echo "yes";} else {echo "no";}

I want to check this condition but it always return "yes" because condition variable has some string. How can I actually check the condition that 21 is greater than 20. Can anyone pass through this kind of problem? Thanks.

Aucun commentaire:

Enregistrer un commentaire