All Combinations and Log?
Moderator: General Moderators
All Combinations and Log?
How would one put all combinations of an alphanumeric code into a URL bar and then log that? For example, www.google.com/sites/aaaaaa.html, www.google.com/sites/aaaaab.html, www.google.com/sites/aaaaac.html and so on and so on.
Re: All Combinations and Log?
im not really sure how to automate the alpanumeric characters...but if you set all of them into an array and use a foreach() loop. you could echo every possibility into a url
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: All Combinations and Log?
Strings can be incremented in the manner you describe very easily. Here's some examples:
And so on. So, to loop through all combinations would be very easy.
Code: Select all
$string = 'aaaaaa';
$string++;
echo $string; // outputs "aaaaab"
$string = 'aaaaaz';
$string++;
echo $string; // outputs "aaaaba"
$string = 'zzzzzz';
$string++;
echo $string; // outputs "aaaaaaa"; notice, now seven instead of sixCode: Select all
for ($i = 'aaaaaa'; $i != 'aaaaaaa'; $i++) {
// do something with $i
}Re: All Combinations and Log?
Thanks guys!