variables in math question
Posted: Mon Dec 27, 2004 5:14 pm
Hello,
I am wondering if it is all possible to have a variable operate a math command like...
$set = '+';//$set comes from a database and it changes
echo (10 $set 4); // would return 14
This doesnt seem to work so I am wondering if I would have to do
if($set == '+'){ echo (10 + 4); }
if anyone can figure out how to do that other way please share, thanks.
It would be a big time saver since there are 6 of these
I am wondering if it is all possible to have a variable operate a math command like...
$set = '+';//$set comes from a database and it changes
echo (10 $set 4); // would return 14
This doesnt seem to work so I am wondering if I would have to do
if($set == '+'){ echo (10 + 4); }
if anyone can figure out how to do that other way please share, thanks.
It would be a big time saver since there are 6 of these