[ create a new paste ] login | about

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

PHP, pasted on Aug 24:
<?php

$length = 10;

$letters = array(
		'B','C','D','F','G','H','J','K','L','M','N','O',
		'P','Q','R','S','T','V','W','X','Y','Z','1','2',
		'3','4','5','6','7','8','9','0'
	);

$index = array_fill(0, $length, 0);

$key = $length - 1;
$count = 10;
while($count--) {   
    $code = "";
    for($i=0;$i<$length;$i++) {     
        $code .= $letters[$index[$i]];      
    }
    echo $code ."\n"; // output code

    $index[$key]++;

    while(!isset($letters[$index[$key]])) {
        $index[$key] = 0;
        $key--;
        if($key < 0) {
            break 2;
        }       
        $index[$key]++;
    }   
    $key = $length - 1; 
}


Output:
1
2
3
4
5
6
7
8
9
10
BBBBBBBBBB
BBBBBBBBBC
BBBBBBBBBD
BBBBBBBBBF
BBBBBBBBBG
BBBBBBBBBH
BBBBBBBBBJ
BBBBBBBBBK
BBBBBBBBBL
BBBBBBBBBM


Create a new paste based on this one


Comments: