generate string AAAA to 9999 using php code
In this post we will show you how to generate string AAAA to 9999 using php code. hear we will give you code for generate string AAAA … AAAZ, AA0 … AAA9, AABA … ZZZZ,ZZZ0 … 9999
$addalphabeth = array_merge(range('A', 'Z'), range(0,9)); $setcharacter = []; foreach ($addalphabeth as $setcharacter[0]) { foreach ($addalphabeth as $setcharacter[1]) { foreach ($addalphabeth as $setcharacter[2]) { foreach ($addalphabeth as $setcharacter[3]) { //$setcatalog[] = vsprintf('%s%s%s%s', $setcharacter); echo "<b>".vsprintf('%s%s%s%s', $setcharacter)."</b>"; echo "<br>"; } } } } //print_r($setcatalog);
output For generate string AAAA to 9999 using php code
// output for string AAAA to 9999 using php code AAAA AAAB AAAC . . . . AAA0 . . AAA9 AAAZ AABA . . . . ZZZZ ZZZ0 . . 9999
Print n number of time string
Print string n number of time, pass your number and print it n time
function print_string($number, $prefix = '') { $all_chars = array_merge(range('A', 'Z'), range(0,9)); if ($number == 1) { foreach ($all_chars as $char) { echo "$prefix$char\n"; } } else { $number--; foreach ($all_chars as $char) { echo printAto9($number,$prefix . $char); } } } $number = 6; print_string($number);
Hope this code and post will helped you for implement string generate AAAA to 9999 using php code. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org