Turning a string into a condition
| From: | Marc Guay | Date: | Thu, 16 Feb 2012 20:31:51 +0000 |
| Subject: | Turning a string into a condition | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-316633@lists.php.net to get a copy of this message | ||
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