In PHP I can do:
// $post = 10; $logic = >; $value = 100
$valid = eval("return ($post $logic $value) ? true : false;");
So the statement above would return false.
Can I do something similar in JavaScript? Thanks!
Darren.
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.
yes, there’s
evalin javascript as well. for most uses it’s not considered very good practice to use it, but i can’t imagine it is in php either.