Is it possible to assign a conditional statement into a variable and use it in an if statement? For example, I have the following code where the condition in the if statement will change from time to time:
<?php $x = 2; //This "x > 5" value will come from a database $command = "x > 5";//Some times this value might be x > 5 || x == 1 if($command)//This will always be true no matter what since the content of the $command is not empty echo "x is bigger than 5"; else echo "x is smaller than 5";//I want this line to get executed since x is smaller than 5 in this case ?> Expected output is x is smaller than 5, but what I get is x is bigger than 5