Re: [PHP] Turning a string into a condition

2012-02-17 Thread Marc Guay
Hi everyone, Thanks for all the great ideas and links. Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Turning a string into a condition

2012-02-16 Thread Marc Guay
Hi folks, I've constructed simple conditions based on DB data and would like to actually evaluate them with PHP. For example, the coded string $x $y has been str_replaced into 4 5, but now I would actually like to use that string in an if() statement. I tried eval() but got an unhelpful

Re: [PHP] Turning a string into a condition

2012-02-16 Thread Joshua Kehn
Can you explain a more clearly what it is you're trying to accomplish? It sounds like you have a string $x $y in the database that you then replace into a string 4 5 which you want to test a conditional on. If this is the case, why are you storing conditionals in the database? Regards,

Re: [PHP] Turning a string into a condition

2012-02-16 Thread Marc Guay
It sounds like you have a string $x $y in the database that you then replace into a string 4 5 which you want to test a conditional on. If this is the case, why are you storing conditionals in the database? The user will be able to construct their own query strings, it's complicated but

Re: [PHP] Turning a string into a condition

2012-02-16 Thread Ashley Sheridan
On Thu, 2012-02-16 at 15:38 -0500, Marc Guay wrote: It sounds like you have a string $x $y in the database that you then replace into a string 4 5 which you want to test a conditional on. If this is the case, why are you storing conditionals in the database? The user will be able to

Re: [PHP] Turning a string into a condition

2012-02-16 Thread Marc Guay
I just added the return statement and the semicolon, because the error was complaining about it not being a proper PHP statement basically. That's beautiful, thanks. I just stumbled across a forum post that said it wasn't possible and was about to give up for the day. Marc -- PHP General

Re: [PHP] Turning a string into a condition

2012-02-16 Thread Matijn Woudt
On Thu, Feb 16, 2012 at 9:49 PM, Marc Guay marc.g...@gmail.com wrote: I just added the return statement and the semicolon, because the error was complaining about it not being a proper PHP statement basically. That's beautiful, thanks.  I just stumbled across a forum post that said it wasn't

Re: [PHP] Turning a string into a condition

2012-02-16 Thread Marc Guay
It shouldn't be that hard to parse this type of expressions. I appreciate your concern, and will do my best to validate the input, but there are two things: 1) The application will only be used by selected users. and 2) The range of possibilities are broader than I indicated. They would like

Re: [PHP] Turning a string into a condition

2012-02-16 Thread Kevin Kinsey
On Thu, Feb 16, 2012 at 04:37:18PM -0500, Marc Guay wrote: It shouldn't be that hard to parse this type of expressions. I appreciate your concern, and will do my best to validate the input, but there are two things: 1) The application will only be used by selected users. and 2) The

Re: [PHP] Turning a string into a condition

2012-02-16 Thread Matijn Woudt
On Thu, Feb 16, 2012 at 10:37 PM, Marc Guay marc.g...@gmail.com wrote: It shouldn't be that hard to parse this type of expressions. I appreciate your concern, and will do my best to validate the input, but there are two things: 1)  The application will only be used by selected users. and

Re: [PHP] Turning a string into a condition

2012-02-16 Thread Marco Behnke
Am 16.02.12 22:37, schrieb Marc Guay: 2) The range of possibilities are broader than I indicated. They would like to be able to enter conditions of all sorts. i.e. ($x / $y) 0.5 (($a+$b+$c) / $d) .75 etc. If you have any suggestions on how to increase the security while maintaning the