Re: 2 decimal places
| From: | Evan Nemerson | Date: | Tue, 25 Sep 2001 17:38:50 +0000 |
| Subject: | Re: 2 decimal places | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68745@lists.php.net to get a copy of this message | ||
Yeah, but what if they don't JUST want to print it...
/*untested*/
$i=524;
$n=5-strlen($i);
$outnum="";
for($x=1;$x<=$n;$x++){
$outnum.="0";
};
$outnum.=$i;
On Tuesday 25 September 2001 09:56, you wrote:
> > What if I want to pad a number with zeros in the other
> > direction? I.E:
> > 524 becomes 00524
>
> printf() / sprintf() is your friend.
>
> Chris