www.webdeveloper.com
Results 1 to 6 of 6

Thread: Decimal

  1. #1
    Join Date
    Apr 2003
    Location
    Vermont (USA)
    Posts
    343

    Decimal

    How do you tell php to print only up to 2 decimal places

    From 4.66666666667
    to 4.66 Or 4.67 depending on how it works?

  2. #2
    Join Date
    Feb 2005
    Location
    The Netherlands
    Posts
    40
    Easy

    PHP Code:
    echo round(4.666666666672); //Shows 4.67 
    For more info:

    http://php.net/round

  3. #3
    Join Date
    Apr 2003
    Location
    Vermont (USA)
    Posts
    343

    thanks

    oh and what is the main difference of

    print and echo??

    because someitmes i see print, sometimes i see echo. Is there a better one or what?

  4. #4
    Join Date
    Feb 2005
    Location
    The Netherlands
    Posts
    40
    For that, I'll redirect you here:

    http://www.google.nl/search?q=echo%2...%2C+difference

    Check out the first 2 hits, they have enough info about your question.

  5. #5
    Join Date
    Apr 2003
    Location
    Vermont (USA)
    Posts
    343

    thanks

    that helped

  6. #6
    Join Date
    Mar 2003
    Posts
    575
    http://us3.php.net/manual/en/function.number-format.php

    I think that this is closer to what Justin wants.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles