if i take and do something like this:
$p = 10;
$n = 3;
$evalstr = "\$f = 0.99 + ((.025 * \$p) * \$n);";
eval($evalstr);
echo $f;
I get 1.74 displayed, no errors everything is fine, but when I have a mysql table that holds these equations (for the purpose of this example, it is the exact same equation)...like so:
$p = 10;
$n = 3;
while ($result = mysql_fetch_assoc($results)) {
$math = $result['math'];
//at this point $math = "\$f = 0.99 + ((.025 * \$p) * \$n);"
eval($math);
}
I get Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in ajax\getprices.php(30) : eval()'d code on line 1
Unsure as to why, if i print of echo $math is it identical to what I have as $evalstr in the first example. $p and $n are actually set from GET variables but even if I set them manually as in the example it does not work.
eval()withvar_dump($math)and tell us exactly what it prints out.