Rounding problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roger Godefroy

    Rounding problem

    Hi there,

    If I use round(1.95583, 2); I would get the perfect result of 1.96 for my
    currency. But if I round(1.9) I would just get 1.9. Is there a function or
    solution so it would always round with 2 digits for a currency?

    thnxz...


  • Eivind Lie Nitter

    #2
    Re: Rounding problem

    Roger Godefroy <godefroy@(nosp am)home.nl> wrote:
    [color=blue]
    > Hi there,
    >
    > If I use round(1.95583, 2); I would get the perfect result of 1.96 for my
    > currency. But if I round(1.9) I would just get 1.9. Is there a function or
    > solution so it would always round with 2 digits for a currency?
    >
    > thnxz...[/color]

    Check out number_format()




    --
    Eivind Lie Nitter
    eln@gmx.net
    This domain is parked at DreamHost

    Comment

    • Roger Godefroy

      #3
      Re: Rounding problem

      Thanks... problem solved...

      "Eivind Lie Nitter" <eln@gmx.net> schreef in bericht
      news:1fz48pq.1o smy9s1p53lz8N%e ln@gmx.net...[color=blue]
      > Roger Godefroy <godefroy@(nosp am)home.nl> wrote:
      >[color=green]
      > > Hi there,
      > >
      > > If I use round(1.95583, 2); I would get the perfect result of 1.96 for[/color][/color]
      my[color=blue][color=green]
      > > currency. But if I round(1.9) I would just get 1.9. Is there a function[/color][/color]
      or[color=blue][color=green]
      > > solution so it would always round with 2 digits for a currency?
      > >
      > > thnxz...[/color]
      >
      > Check out number_format()
      >
      > http://php.net/number_format
      >
      >
      > --
      > Eivind Lie Nitter
      > eln@gmx.net
      > http://ununique.net[/color]


      Comment

      Working...