Re: Turning a string into a condition
| From: | Joshua Kehn | Date: | Thu, 16 Feb 2012 20:36:48 +0000 |
| Subject: | Re: Turning a string into a condition | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316634@lists.php.net to get a copy of this message | ||
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,
–Josh
____________________________________
Joshua Kehn | @joshkehn
http://joshuakehn.com
On Feb 16, 2012, at 3:31 PM, Marc Guay wrote:
> 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 error, any thoughts would be welcome.
>
> Marc
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>