I have an array of conditions :
$arrConditions = array ('>=2', '==1', '<=10');
...which I want to be able to use in an if...statement.
IE.
if (5 $arrConditions[0])
{
...do something
}
...which would be the same as :
if (5 >= 2)
{
...do something
}
Any help?
Thanks
eval, but it will be horribly slow and you didn't hear it from me. Or, much preferably, you can roll up your sleeves and do it manually:switch($operator) { case '==': $result = $input == $operand; }etc.IFrequires aconditionwhich outputstrueorfalse. $arrCondition[0] is just a string and there is no operation happening there. which means no evaluation and no output. you can useswitch casefor symbols but it is impossible in case ofIF.