How to implement the variable variables with PHP using database.
When i using hard coded variable variables, its no problem.
Example:
$var1 = 10;
$var2 = 20;
$formula = $var1 * 100 / $var2;
print $formula;
How to implement like sample above, if the variables from fields.
Let say i have 1 table with the field: var1, var2 and formula.
When i try implement the sample:
print $rec['var1']; // printed : 10
print $rec['var2']; // printed : 20
print $rec['formula']; // printed : var1 * 100 / var2 (printed as text not the value from the calculation).
What i want is, i want to implement like the sample above. I have tried "eval" but it doesn't work.
Please i need help from all of yours...
Thank's
Variable Variables using Database
Moderator: General Moderators