[ create a new paste ] login | about

Link: http://codepad.org/tzzAq1z8    [ raw code | output | fork ]

PHP, pasted on Aug 17:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

$code = '';
for($i=0; $i<100; $i++)
{
    $code = getNextAlphaNumeric($code);
    echo "$code\n";
}

function getNextAlphaNumeric($code) {
   $base_ten = base_convert($code,36,10);
   $result = base_convert($base_ten+1,10,36);
   $result = str_pad($result, 3, '0', STR_PAD_LEFT);
   $result = strtoupper($result);
   return $result;
}


Output:
001
002
003
004
005
006
007
008
009
00A
00B
00C
00D
00E
00F
00G
00H
00I
00J
00K
00L
00M
00N
00O
00P
00Q
00R
00S
00T
00U
00V
00W
00X
00Y
00Z
010
011
012
013
014
015
016
017
018
019
01A
01B
01C
01D
01E
01F
01G
01H
01I
01J
01K
01L
01M
01N
01O
01P
01Q
01R
01S
01T
01U
01V
01W
01X
01Y
01Z
020
021
022
023
024
025
026
027
028
029
02A
02B
02C
02D
02E
02F
02G
02H
02I
02J
02K
02L
02M
02N
02O
02P
02Q
02R
02S


Create a new paste based on this one


Comments: