Thread: truncate ?

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    france
    Posts
    35
    Rep Power
    14
    hi !
    how do you truncate a number ?
    eg 16.66666666666666 to 16.67 ?

    Thanx

    -
    J0f
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    14
    Use number_format(). The second argument speciifes the number of decimal points to round to:

    $number = number_format($number, 2);
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    france
    Posts
    35
    Rep Power
    14
    thanx !

Similar Threads

  1. truncate command in mysql
    By mai in forum MySQL Help
    Replies: 1
    Last Post: February 10th, 2004, 11:31 AM
  2. truncate a file
    By Icek in forum C Programming
    Replies: 2
    Last Post: July 6th, 2003, 01:15 PM
  3. How do I truncate text? + How do I insert <BR>?
    By gashad in forum PHP Development
    Replies: 11
    Last Post: December 19th, 2002, 06:52 PM
  4. Don't truncate to 0!!!
    By Disk-t in forum PHP Development
    Replies: 17
    Last Post: October 11th, 2001, 12:56 PM
  5. truncate MySQL text field to 50 characters
    By hayden in forum PHP Development
    Replies: 3
    Last Post: September 20th, 2001, 12:29 PM

IMN logo majestic logo threadwatch logo seochat tools logo