oops, sorry - try this instead
sprintf/printf("%07d", $num)
-Original Message-
From: Boaz Yahav [mailto:[EMAIL PROTECTED]
Sent: Friday, March 21, 2003 8:23 AM
To: Martin Towell; Harry.de; [EMAIL PROTECTED]
Subject: RE: [PHP] Zero Fill -> Number Format
wouldn't thi
> $something = 26;
> $something = sprintf('%7d', $something);
> $something = str_replace(' ', '0', $something);
> echo $something;
This is a bit more direct:
$something = 26;
echo str_pad($something, 7, '0', STR_PAD_LEFT);
Chris
=
Become a better Web developer with the HTTP Developer's Hand
M
> To: 'Harry.de'; [EMAIL PROTECTED]
> Subject: RE: [PHP] Zero Fill -> Number Format
>
> sprintf/printf("%7d", $num)
>
> -Original Message-
> From: Harry.de [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 20, 2003 10:09 AM
> To: [EMAIL P
wouldn't this just print empty spaces before the number instead of the
needed Zeros?
-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 1:11 AM
To: 'Harry.de'; [EMAIL PROTECTED]
Subject: RE: [PHP] Zero Fill -> Number Forma
, but it works
perfectly for me since it will zero-fill for any length of numbers and pad
the shorter numbers appropriately.
> -Original Message-
> From: Harry.de [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 20, 2003 10:09 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Ze
This one time, at band camp,
"Harry.de" <[EMAIL PROTECTED]> wrote:
> How can I put out a Zero Fill for numbers
> The result should be
>
> $something=26;
print str_pad($something, 7, "0", STR_PAD_LEFT);
Kevin
__
(_ \
_) ) _
tly for me since it will zero-fill for any length of numbers and pad
the shorter numbers appropriately.
-M
-Original Message-
From: Harry.de [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 6:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Zero Fill -> Number Format
How can I pu
sprintf/printf("%7d", $num)
-Original Message-
From: Harry.de [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 10:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Zero Fill -> Number Format
How can I put out a Zero Fill for numbers
The result should be
$something=26;
ec
How can I put out a Zero Fill for numbers
The result should be
$something=26;
echo $something;
e.g.
026
I didn't found a solution with number format. Is there any other way?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
9 matches
Mail list logo