SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: round??

  1. #1
    SitePoint Addict joyce's Avatar
    Join Date
    Aug 2001
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    round??

    how to round up numbers for eg.

    5.185 becomes 5.19??

    i tried this...
    $have_to_pay = round($have_to_pay2, 2);
    but i got 59.18 instead of 59.19

  2. #2
    The short answer is yes... Herbster's Avatar
    Join Date
    Oct 2001
    Location
    Bay City, Oregon
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Stolen from the PHP docs.
    If you want .5 to always round up, add 0.00000001 to the number before rounding.

    http://www.php.net/manual/en/function.round.php
    Last edited by Herbster; May 15, 2003 at 19:59.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •