I’ve got this problem where I’m using JS to grab today’s currency rates and I’m trying to multiply that currency rate with a value that the user enters.
I’ve created another page called currency.php just to try and troubleshoot the problem, but I can’t seem to get it.
If I echo $var1, it will give the conversion perfectly fine.
[code=php]
$var1 = “<script>currency_show_conversion(100,’USD’,’CAD’);</script>”;
Now if I try to multiply $var1 * $var2, the result will be 0. Does anyone know why this is happening or how I can fix it?
[code=php]
$var1 = “<script>currency_show_conversion(100,’USD’,’CAD’);</script> CAD<br>”;
$var2 = 20;
$calculation = $var1 * $var2;
echo $calculation;
EDIT:
I should also note that I’ve tried this and it does not work.
[code=php]
$var1 = “<script>currency_show_conversion(100,’USD’,’CAD’)</script>”;
$var_int = $var1;
$var2 = 20;
$var = $var_int * $var2;
echo $var;