RE: [PHP] number_format
| From: | Scott St. John | Date: | Fri, 08 Mar 2002 18:43:34 +0000 |
| Subject: | RE: [PHP] number_format | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87808@lists.php.net to get a copy of this message | ||
Ok, I think I got it using this:
$anum = number_format($fie31,2);
$anum = str_replace($replace_char, $replace_strings, $anum);
On Fri, 8 Mar 2002, Alastair Battrick wrote:
> why not multiply the number by 1000 and then use
> str_pad($in,6,"0",STR_PAD_LEFT)
>
> Alastair Battrick
> Senior Developer
> Lightwood Consultancy Ltd
> http://www.lightwood.net
>
> > -----Original Message-----
> > From: Scott St. John [mailto:scott@scottah.com]
> > Sent: 08 March 2002 17:02
> > To: php-general@lists.php.net
> > Subject: [PHP] number_format
> >
> >
> > Hi everyone,
> >
> > I am trying to format a number for a report, the one consistant thing is
> > the three decimal places. But I need to strip them, then fill in zero's
> > from the left.
> >
> > So, if the number coming in is 8.000 I need to convert to 00800, 11.070
> > would convert to 01107.
> >
> > I have tried a combination of number_format and usually end up with 8000
> > or 00110.
> >
> > Help! Thank you! Mind in slow motion this morning.
> >
> > -Scott
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
--