Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 02-10-2007, 04:56 AM
Junior Member
 
Join Date: 02-10-07
Posts: 9
iTrader: 0 / 0%
PHP: going through all possible combinations

How can I go through all possible combinations from A to Z with f.e. 4 letters? It should print something like this:

aaaa
aaab
aaac
aaad
aaae

etc.

So how can I do this with PHP? Or is it even possible?
 
Reply With Quote
  #2 (permalink)  
Old 02-10-2007, 05:39 AM
jumpenjuhosaphat's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 07-22-06
Location: Denver, Colorado, USA
Posts: 469
iTrader: 0 / 0%
Sure it's possible, one way to do it, probably the simplest, is to nest 4 loops.

Code:
for($a=97; $a<123; $a++){ for($b=97; $b<123; $b++){ for($c=97; $c<123; $c++){ for($d=97; $d<123; $d++) { echo chr($a).chr($b).chr($c).chr($d); }}}}
 
Reply With Quote
  #3 (permalink)  
Old 02-10-2007, 06:58 AM
Junior Member
 
Join Date: 02-10-07
Posts: 9
iTrader: 0 / 0%
Okay, thanks.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Word Combinations And The Copyright Or Trademark Issues bermuda Internet Legal Issues 0 09-02-2007 04:24 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 09:31 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2014 Escalate Media




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.