> This is probably simple, but I'm baffled. I have my
> own shopping cart up and running for a plant nursery
> site. Everything is fine and dandy until someone
> places a really large order. When the subtotal is over
> $1000, all of the calculations for sales tax and
> shipping charges get set to minimum values. I plug in
> code to echo the value for the subtotal variable in
> comments to see what's going on, and the number is
> represented with a comma, something like 1,204.50
> When I try test calculations with numbers represented
> like that, php returns an error. When I manually strip
> out the comma, all is well. Is there a function
> something like stripcommas() to treat these large
> numbers as numbers instead of strings?


You should keep the number as a floating point value until you are ready to
display it.  Then use number_format() for the displayed value.

For your value with commas you can use str_replace() to get rid of the commas
in the numeric values.

James
_____


James D. Keeline
http://www.Keeline.com  http://www.Keeline.com/articles
http://Stratemeyer.org  http://www.Keeline.com/TSCollection

http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
Spring Semester Begins Jan 31 -- New Classes Start Every Few Weeks.


Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to