Re: Generating sequence of AlphaNumber

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 15 Nov 2007, Jeffery Fernandez wrote:

> Hi all,
>
> I am having trouble generating a sequence of numbers from the following start
> value:
> AX0001
>
> what I have done so far is loop through each character and check if its a
> alphabet and separating the characters and digits.
>
> But when I increment the digits, its strips of the leading zeros. How can I
> get a sequence of values like:
>
> AX0001
> AX0002
> AX0003
> AX0004
> .....
> AX0099
> AX0100
>
> and so on ?
>
> jeffery
> --


Probably the easiest way is sprintf(); for example,

	 sprintf('%04.0d', 34) returns 0034

See

	http://www.php.net/sprintf

...........................................................
. Steve Edberg                       sbedberg@xxxxxxxxxxx .
. Computer Consultant     University of California, Davis .
.                                           (530)754-9127 .
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux