Re: 2 decimal places
| From: | Meir Kriheli | Date: | Tue, 25 Sep 2001 22:59:16 +0000 |
| Subject: | Re: 2 decimal places | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68785@lists.php.net to get a copy of this message | ||
On Tuesday 25 September 2001 18:48, Jason Bell wrote:
> What if I want to pad a number with zeros in the other direction? I.E:
>
>
> 524 becomes 00524
>
printf('%05d',$the_number);
Prints the number padded to 5 chars with 0.
I suggest you read the manual about printf() and sprintf() functions (there
are good examples about formatting in sprintf()'s documentation).
--
Meir Kriheli
>
> ----- Original Message -----
> From: "Christian Dechery" <cdechery@easynet.com.br>
> To: "Kurth Bemis" <kurth@usaexpress.net>
> Cc: <php-general@lists.php.net>
> Sent: Tuesday, September 25, 2001 9:41 AM
> Subject: Re: [PHP] 2 decimal places
>
> > At 22:22 19/09/01 -0400, Kurth Bemis wrote:
> > >i'm looking for a php function to add 2 decimal place sto a number. if
> > >the number already have one decimal place then one more zero should be
> > >added to make it two decimal places....anyone know of a quick way to do
>
> this?
>
> > $number=32.5;
> >
> > echo number_format($number,2);
> >
> > outputs:
> > "32.50"
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net