[PHP] simple math computation..
the percent of 20% is = .20 right? how can i compute the correct value for this? my $totalCost is $4,000 and when i compute it to .20 using this method.. $shippingestimate = $totalCost * .20; i get the value for the shippingestimate = $0.8 which is wrong.. it should $800 what seems to be wrong? -- Louie Miranda http://www.axishift.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple math computation..
On Monday 04 October 2004 15:26, Louie Miranda wrote: the percent of 20% is = .20 right? 'don't know what's the pecent of 20% is ;) but in decimal form, yes, it's right. Or, just .2 or 0.2. how can i compute the correct value for this? my $totalCost is $4,000 and when i compute it to .20 using this method.. $shippingestimate = $totalCost * .20; i get the value for the shippingestimate = $0.8 which is wrong.. it should $800 what seems to be wrong? Formatting problem, most likely. Try this: ?php $totalCost = 4000; $shippingEstimate = $totalCost * 0.2; echo $shippingEstimate; ? * I changed the E on $shippingEstimate on purpose :) -- - E - copperwalls was here ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple math computation..
Howdy. It seems to work fine for me, perhaps you have a typo along the lines some where. ?php $totalCost = 4000; $shippingestimate = $totalCost * .20; echo $shippingestimate; ? echoes 800 -- Regards, Matthew Fonda On Sun, 2004-10-03 at 23:26, Louie Miranda wrote: the percent of 20% is = .20 right? how can i compute the correct value for this? my $totalCost is $4,000 and when i compute it to .20 using this method.. $shippingestimate = $totalCost * .20; i get the value for the shippingestimate = $0.8 which is wrong.. it should $800 what seems to be wrong? -- Louie Miranda http://www.axishift.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple math computation..
i found the culprit. i remembered, that i use to pass the value with.. number_format($totalCost, 2, ., ,) so the values being received by my computation has a , comma 4,000 so that is why i always get wrong values. thanks again! On Mon, 04 Oct 2004 00:02:32 -0700, Matthew Fonda [EMAIL PROTECTED] wrote: Howdy. It seems to work fine for me, perhaps you have a typo along the lines some where. ?php $totalCost = 4000; $shippingestimate = $totalCost * .20; echo $shippingestimate; ? echoes 800 -- Regards, Matthew Fonda On Sun, 2004-10-03 at 23:26, Louie Miranda wrote: the percent of 20% is = .20 right? how can i compute the correct value for this? my $totalCost is $4,000 and when i compute it to .20 using this method.. $shippingestimate = $totalCost * .20; i get the value for the shippingestimate = $0.8 which is wrong.. it should $800 what seems to be wrong? -- Louie Miranda http://www.axishift.com -- Louie Miranda http://www.axishift.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php