Hi Pedro, Hi Erwin,
thanks for the proposals. But I might have not been clear enough.
You hand over the expression as a TRUE/FALSE result. Of course this
works (with one exception - if expression is FALSE you won't be able
to have an else statement - at least in my hands it cancels the else
fork).
What I wanted is a little different (and more complicated). My
if-expressions should be stored as a string, because I fetch them from
a database. Now I want to use them in a PHP-context. [Reason for this
is that I check plausabilities in forms, depending on the result of
selected formfields - the according plausibilities are defined in the
database]
So, is there any chance to convert a string
"$a > $b"
into an expression/result
TRUE/FALSE.
??
Sorry for having been inprecise in my forst posting...
Maybe there is an answer.
Cheers,
Chris
In addition to Pedro's posting:
I find it usefull to use the following construct in such situations:
$total = (($num<100) ? 12 : 50) * 1.5;
Try this:
<Pedro snip>
<?php
$a = 5;
$b = 10;
$expr1 = ($a > $b);
$expr2 = ($a < $b);
if ($expr1) echo 'expr1 is true';
else echo 'expr1 is false';
echo "<pre>\n\n\n</pre>";
if ($expr2) echo 'expr2 is true';
else echo 'expr2 is false';
?>
</Pedro snip>