|
Posted by michael on 09/09/07 18:23
I'm not sure what you mean, but you could parse it as a PHP code in
your PHP.
Let me create small example.
Your php code:
<?php
$C1=23;
$C2=30;
//Building a Match expression
$math_expression = 'return 200 / 10 * $C1 + $C2;';
$result = eval($math_expression);
print $math_expression . " = " . $result;
?>
On Sep 9, 8:07 pm, "_mario.lat" <n...@libero.it> wrote:
> Hallo,
> I'd like to parse and calculate the value of an expression.
> Any suggestion?
>
> for example:
> I have these constants: C1=2, C2=4, C3=6, ...
> and user write this:
> C1*2*(log(1+C2)/C3)*4
>
> And I'd like to calculate the value.
> How can I do that?
> Thankyou in advance,
> Mario.
[Back to original message]
|