Skip to content

Instantly share code, notes, and snippets.

@Lotuashvili
Created April 23, 2015 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lotuashvili/9fc0ac47b46c68dfe25b to your computer and use it in GitHub Desktop.
Save Lotuashvili/9fc0ac47b46c68dfe25b to your computer and use it in GitHub Desktop.
მანქანის სანომრე ნიშნების შესაძლო ვარიანტები
<?php
$letters = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
];
$nums = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
];
$count = 0;
foreach ($letters as $l1) {
foreach ($letters as $l2) {
foreach ($letters as $l3) {
foreach ($letters as $l4) {
foreach($nums as $n1) {
foreach($nums as $n2) {
foreach($nums as $n3) {
$l1 = strtoupper($l1);
$l2 = strtoupper($l2);
$l3 = strtoupper($l3);
$l4 = strtoupper($l4);
$count++;
echo $l1.$l2.$n1.$n2.$n3.$l3.$l4." - ";
}
}
}
}
}
}
}
echo $count; // 26 * 26 * 10 * 10 * 10 * 26 * 26 = 456,976,000
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment