Reply to Re: how to parse an math expression?

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация