Shoutbox

Combonation Outputter ? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Combonation Outputter ? (/showthread.php?tid=59965)

Combonation Outputter ? by banky on 05-31-2006 at 07:16 AM

I was wondering if anyone knew of a combonation outputter or could make one that would put out all possible 5 digit combonations of the numbers 0 to 9.

Example :
12345
54321
99821

etc. Put only a program that could do this alot faster then having to write every single one down


RE: Combonation Outputter ? by Ezra on 05-31-2006 at 01:55 PM

that's just 00000 to 99999 isn't it?


RE: Combonation Outputter ? by J-Thread on 05-31-2006 at 02:18 PM

code:
for($i = 0; $i < 100000; $i++) {
   print ensure_len($i, 5) . "\n";
}

function ensure_len($num, $len) {
   $num = (string)$num;
   while(strlen($num) < $len) {
      $num = "0" . $num;
   }
   return $num;
}

That's a simple PHP script to do it... Shouldn't be too hard right:S
RE: Combonation Outputter ? by WDZ on 05-31-2006 at 04:17 PM

quote:
Originally posted by J-Thread
function ensure_len(
You could have used str_pad() for that, no? :p