Quick PHP question?

Discussion in 'OT Technology' started by o2, Aug 30, 2006.

  1. o2

    o2 Witty Title Here OT Supporter

    Joined:
    Oct 4, 2005
    Messages:
    16,099
    Likes Received:
    11
    Location:
    Toronto
    Is there a function that rounds a number to the nearest 0.5? All I could find is 1 decimal place....
     
  2. piratepenguin

    piratepenguin New Member

    Joined:
    Jun 18, 2006
    Messages:
    1,067
    Likes Received:
    0
    Location:
    Ireland
    You can do:

    round ($number * 2) / 2

    Thanks to HarryR in ##php on irc.freenode.net who got me thinking in the right direction (those IRC channels are handy for quick questions like that).
     
  3. o2

    o2 Witty Title Here OT Supporter

    Joined:
    Oct 4, 2005
    Messages:
    16,099
    Likes Received:
    11
    Location:
    Toronto
    Interesting. Thanks!
     

Share This Page