Hello Ethan,

$onum=4.11440;
$onum =number_format($onum,2)+0;
echo $onum;

With this technique, you get the following:

$onum     output
4.166     4.12
4.135     4.11
4.000     4
4.3000    4.3

Is that what you wanted? To me, it's much easier to code and use
than reg expressions and replaces.

Best regards,
 Randy   


Thursday, January 25, 2001, 1:10:18 PM, you wrote:

EN> I need to format decimals that are percise to the second place in the
EN> following format:

EN> 4.00 to 4
EN> 4.50 to 4.5
EN> 4.25 to 4.25

EN> As you can see, I just want to drop the trailing zeros, and if necessary the
EN> decimal.

EN> Thanks

EN> ___________________________________
EN> Ethan Nelson, Systems Administrator
EN> Net Solutions, LLC
EN> 840 Lawrence Street
EN> Eugene, OR 97401
EN> [EMAIL PROTECTED]
EN> http://www.netsolutionsllc.com
EN> Voice +1 541 345-7087
EN> Fax   +1 541 485-5519



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to