Thank you, The Red Devil and Space Phoenix, for your encouragement. Here’s the code that I have so far:
<?
//generate a random string of 11 alphanumeric characters without vowels
function random_string()
{
$character_set_array = array();
$character_set_array[] = array('count' => 11, 'characters' => 'BCDFGHJKLMNPQRSTVWXYZ0123456789');
$temp_array = array();
foreach ($character_set_array as $character_set) {
for ($i = 0; $i < $character_set['count']; $i++) {
$temp_array[] = $character_set['characters'][rand(0, strlen($character_set['characters']) - 1)];
}
}
shuffle($temp_array);
return implode('', $temp_array);
}
$randomdigits=random_string();
//change all letters to numbers based on ordinal position and starting with B as eleven
$randomdigits = str_replace('B','11', $randomdigits);
$randomdigits = str_replace('C','12', $randomdigits);
$randomdigits = str_replace('D','13', $randomdigits);
$randomdigits = str_replace('F','15', $randomdigits);
$randomdigits = str_replace('G','16', $randomdigits);
$randomdigits = str_replace('H','17', $randomdigits);
$randomdigits = str_replace('J','19', $randomdigits);
$randomdigits = str_replace('K','20', $randomdigits);
$randomdigits = str_replace('L','21', $randomdigits);
$randomdigits = str_replace('M','22', $randomdigits);
$randomdigits = str_replace('N','23', $randomdigits);
$randomdigits = str_replace('P','25', $randomdigits);
$randomdigits = str_replace('Q','26', $randomdigits);
$randomdigits = str_replace('R','27', $randomdigits);
$randomdigits = str_replace('S','28', $randomdigits);
$randomdigits = str_replace('T','29', $randomdigits);
$randomdigits = str_replace('V','31', $randomdigits);
$randomdigits = str_replace('W','32', $randomdigits);
$randomdigits = str_replace('X','33', $randomdigits);
$randomdigits = str_replace('Y','34', $randomdigits);
$randomdigits = str_replace('Z','35', $randomdigits);
?>
So now, we wind up with $randomdigits as only numberals, which is great. But alas, that’s all I’ve been able to accomplish so far. I still need to multiply every other digit of $randomdigits by 2 starting with the right-most digit; convert any two-digit products from the preceding step into 2 one-digit numbers; add all the digits together; and finally
subtract the sum from the next highest number ending in zero to yield the check digit.
I am diligent, but stuck. Any help would be greatly appreciated! Thank you very much.