SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Location
    Monmouth Junction, NJ
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lets say 113/25 equals 4.somehting how can you do it php so only 4 shows up or even better make it round up to a whole number so its 5?

  2. #2
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might be interested in: ceil()
    www.php.net/ceil
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  3. #3
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use the round() function.

    double round (double val [, int precision])

    Returns the rounded value of val to specified precision (number of digits after the decimal point).

    http://www.php.net/manual/en/function.round.php

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Location
    Monmouth Junction, NJ
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks that ceil is pretty cool

  5. #5
    SitePoint Member
    Join Date
    Apr 2001
    Location
    The Netherlands
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Depending on the way you want to round it you could consider: floor(), round() or ceil()

    Good luck
    Did that sound biased?


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
  •