Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 10 Times in 10 Posts

    Limit decimal places for double values...

    I calcualate a double value and I get a number like "93.255842476" (without qutoes of course). How would I get it to limit the decimal place so it would be "93.25".

    This is possible I do believe but I'm unsure and my searching attempts have failed.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #2
    Regular Coder dswimboy's Avatar
    Join Date
    Nov 2003
    Location
    mostly in Ann Arbor
    Posts
    458
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    $number 93.255842476;
    $numformat number_format($number2); 
    check out http://us3.php.net/manual/en/function.number-format.php for more info.
    "There is more than one way to do it."

  • #3
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 10 Times in 10 Posts
    Thanks man.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com


  •  

    Posting Permissions

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