Evaluating Variables as IF conditions
Posted: Tue Jan 02, 2007 5:02 am
onion2k | Please use
Can someone out there help?
onion2k | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi...
I've been struggling to find a solution to a situation that has me stumped.
The application I am developing needs to store 'rules' in a database that are then evaluated within the code.
(i.e. the user can write custom rules)
What i want to do is this:
if ($rule){Do something}
Where $rule is an if condition that I retrieve from the database and will look something like this - i.e. ' $this->status=="valid" and ($otherObj->emailsend=="yes" or $this->post=="yes") '
I tried it in test code (below), (at least how I [i]hoped[/i] it would work), but it always returns 'pending':Code: Select all
$status="someVal";
$x="$status=='Pending'";
if ($x){echo "pending";}
else{echo "Not-pending";}Can someone out there help?
onion2k | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]