Skip to content

Instantly share code, notes, and snippets.

@kworthington
Created February 4, 2014 22:34
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 kworthington/8813754 to your computer and use it in GitHub Desktop.
Save kworthington/8813754 to your computer and use it in GitHub Desktop.
/* Reference: http://mattonomics.com/guess-a-four-digit-number-in-php/ */
/* I didn't look into how to pass into POST variables, but this will spit out 0000-9999 */
$input = 0;
while ($input < 10000)
{
echo str_pad($input, 4, "0", STR_PAD_LEFT) . "<br />";
$input++;
}
@mattonomics
Copy link

Nice!

You could make that really short like so: https://gist.github.com/mattonomics/20858ffecf431e794148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment