Re: number formatting
| From: | Valerio Ferrucci | Date: | Wed, 14 Feb 2001 15:19:50 +0000 |
| Subject: | Re: number formatting | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6618@lists.php.net to get a copy of this message | ||
This is not what I want.
I want only remove the right zeros, that is:
$a = 2.1;
number_format($a, 2, ",", "."); // 2,10
I want to display 2,1
$a = 2.00;
number_format($a, 2, ",", "."); // 2,00
I want to display 2
$a = 2.46;
number_format($a, 2, ",", "."); // 2,46
this is ok I want to display 2,46
Ben Cairns wrote:
> Say, you get the result into a variable called $foo
> You could use:
> floor($foo);
> this would round it DOWN to a whole number:
> EG
> 2.1 returns 2
> 2.9 returns 2
>
> -- Ben Cairns - Head Of Technical Operations
> intasept.COM
> Tel: 01332 365333
> Fax: 01332 346010
> E-Mail: BenC@intasept.com
> Web: http://www.intasept.com
>
> "MAKING sense of
> the INFORMATION
> TECHNOLOGY age
> @ WORK......"
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
==================================================================
Valerio Ferrucci Tabasoft Sas
valfer@flashnet.it http://tabasoft.ancitel.it
taba@flashnet.it