PHP Classes

How to stack up many vars and functions

Recommend this page to a friend!

      Eval Math  >  All threads  >  How to stack up many vars and functions  >  (Un) Subscribe thread alerts  
Subject:How to stack up many vars and functions
Summary:How to accumulate the variables to calculate only at end?
Messages:1
Author:Diego Medeiros
Date:2014-05-22 16:24:08
 

  1. How to stack up many vars and functions   Reply   Report abuse  
Picture of Diego Medeiros Diego Medeiros - 2014-05-22 16:24:08
Thanks for this class! Great work! :D

The class work fine to:

$math->evaluate("xx = 2");
$math->evaluate("yy = 2");
$math->evaluate("zz = xx + yy");
echo $math->evaluate("zz"); //print 4

But I need this:

$math->evaluate("xx = 2");
$math->evaluate("zz = xx + yy"); //yy is undefined
$math->evaluate("yy = 2");
echo $math->evaluate("zz"); //empty

My vars and functions are in a database, are hundreds, so i can't specify the functions order. So, i need accumulate the variables values to calculate only at a specific time (in the end).

I think the answer must lie in the use of the '$this->v[]' variable in class, but I do not have sufficient knowledge to fix it.

How could I do this?? Thanks in advance.
ps: Sorry my bad english.