tags:

views:

22

answers:

1

I need php code to generate 10 digits alphanumeric value with first,third and fourth digit must be Capital alphabet and alphabet 'o' or 'O' should not be in generated code.

+2  A: 

The following should provide you with the building blocks:

$letters = array_merge(range('A','N'),range('P','Z'));

$myRandom = $letters[(rand(1,count($letters))-1)];
$myRandom .= rand(0,9);
for($i = 3; $i <= 4; $i++) {
 $myRandom .= $letters[(rand(1,count($letters))-1)];
}
for($i = 5; $i <= 10; $i++) {
 $myRandom .= rand(0,9);
}

echo $myRandom;
Mark Baker