php-general | 2001092
Date: 09/25/01
- Next message: Boget, Chris: "RE: [PHP] 2 decimal places"
- Previous message: Nathan Cook: "Re: [PHP] php from the command line"
- In reply to: Boget, Chris: "RE: [PHP] 2 decimal places"
- Next in thread: Meir Kriheli: "Re: [PHP] 2 decimal places"
- Reply: Meir Kriheli: "Re: [PHP] 2 decimal places"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Boget, Chris: "RE: [PHP] 2 decimal places"
- Previous message: Nathan Cook: "Re: [PHP] php from the command line"
- In reply to: Boget, Chris: "RE: [PHP] 2 decimal places"
- Next in thread: Meir Kriheli: "Re: [PHP] 2 decimal places"
- Reply: Meir Kriheli: "Re: [PHP] 2 decimal places"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

