Thanks AGISB,
I'm very very new to all of this, so nothing is obvious to me yet...lol.
I understand what you were saying though and found this javascript in a function that someone else wrote...
Code: Select all
function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + num + '.' + cents);
}
When I got rid of it, the equation worked fine.
I am a little confused on the * 1 stuff still if you have a minute. I picked up the idea of performing a mathematic function on a variable to ensure it was being treated as a number as PHP doesn't differentiate between numeric and string variables. So....
$var1 = 1
$var2 = 2
$var1 + $var2 = 3, instead of 12, which it has done before. I understand this isn't the case in higher level programming languages where you specify the variable type.
Any thoughts? Great. If not, thanks for leading me in the right direction!
Philip