, , - -. , , . .
@bishop, , - . , :
. , , . , ABCDE5 ABCDES, .
, , , .
( , , . "S" "5", , , - , , "S" "5", 5, S, , . , , , .)
, , , , , , .
EDIT:
, , :
<?php
$inputs = [
'ABCDEF',
'AAAAA1',
'156ISG',
];
foreach ($inputs as $input) {
print_r(generatePossibleMatches($input));
}
function generatePossibleMatches($input) {
$input = strtoupper($input);
$ambiguous = [
'I' => '1',
'G' => '6',
'S' => '5',
];
$possibles = [$input];
foreach ($ambiguous as $letter => $number) {
foreach ($possibles as $possible) {
foreach (str_split($possible) as $pos => $char) {
$addNumber = substr_replace($possible, $number, $pos, 1);
$addLetter = substr_replace($possible, $letter, $pos, 1);
if ($char === $letter && !in_array($addNumber, $possibles)) {
$possibles[] = $addNumber;
}
if ($char === $number && !in_array($addLetter, $possibles)) {
$possibles[] = $addLetter;
}
}
}
}
return $possibles;
}