Possible Duplicate:
PHP: Calculate a math function f(x) in a string
please anyone help me to solve a math function, for example i want to solve 3x+2y+4z the value of the variable should be declared in php, like $x=4, $y=2, $z=1 i know that there is PHP: Calculate a math function f(x) in a string , but is there any simple method ?
However, you need a parser (Chomsky type-2 language), create the tree representation of you formula and then proceed with the computations. It's pretty much like a simple compiler... – Gianluca Ghettini Nov 06 '12 at 15:39