note 32389 deleted from function.number-format by didou

From: Date: Mon, 26 May 2003 14:41:51 +0000
Subject: note 32389 deleted from function.number-format by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-49036@lists.php.net to get a copy of this message
Note Submitter: rpuchalsky@att.net ---- What I wanted to do was use number_format on decimal numbers with uncertain precision, in cases where I wanted to preserve whatever was to the right of the decimal point without truncating it. I did this by using: $pieces = explode(".", $decimal_number); $formatted_number = number_format($pieces[0]) . "." . rtrim($pieces[1],"0"); Note that rtrim with a second parameter will only work for PHP 4.1., so I actually used a different (database-dependent) solution for that part.

« previous php.notes (#49036) next »