I have 3 variables like this: $first = 2; $second = 5; $operation = ‘*’;
how can I programaticly assign the solution to this math problem to the $answer variable? I have tried eval(), but that does not work.
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.
eval() should work perfectly fine for something like this. Remember that eval() returns NULL though, unless you tell it to return something.