I am trying to modularise a lengthy if..else function.
$condition = "$a < $b";
if($condition)
{
$c++;
}
Is there any way of translating the literal string into a logical expression?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t need to put the condition in a string for that, just store the boolean
trueorfalse:One solution would be a Closure (assuming that definition and usage are happening in the same scope):
But I don’t know if this makes sense for you without remotely knowing what you are trying to accomplish.