SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot manju75's Avatar
    Join Date
    Jul 2006
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php script for word list

    Any possibility to buid word list using this arrays

    $arrray1 = array(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,v,u,w,x,y,z);
    $array2 = array(0,1,2,3,4,5,6,7,8,9);


  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What do you mean by word list? Those arrays provide every letter of the English alphabet, so why not just use a dictionary?

  3. #3
    SitePoint Zealot manju75's Avatar
    Join Date
    Jul 2006
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to get print for one of my project

    like a
    a
    ab
    ba
    abc
    acb
    bac
    cab
    cba

    like all the possibilities

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by manju75 View Post
    like all the possibilities
    There are infinite combinations....

  5. #5
    Twitter - @CarlBeckel busy's Avatar
    Join Date
    May 2004
    Location
    Richmond, VA, USA
    Posts
    819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not infinite, but a whole lot depending on your word size. For example a 3 letter word would have 17576 combinations, a 4 letter word would have 456976 combinations, etc... Luckily, this is something that computers are good at.

    This will get you all 4 letter combinations of letters a-z
    PHP Code:
    <?php

    $alphabet 
    'abcdefghijklmnopqrstuvwxyz';

    $alph str_split($alphabet);
    foreach(
    $alph as $letter1){
      foreach(
    $alph as $letter2){
        foreach(
    $alph as $letter3){
          foreach (
    $alph as $letter4){
            echo 
    $letter1.$letter2.$letter3.$letter4.'<br />';        
          }
        }
      }
    }
    ?>
    if you need numbers and letters use
    PHP Code:
    $alphabet 'abcdefghijklmnopqrstuvwxyz0123456789'

  6. #6
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by busy View Post
    Not infinite, but a whole lot depending on your word size.
    Infinite given no word size. Just multiply infinity by 26 to get the number of combinations with one more letter!

  7. #7
    Twitter - @CarlBeckel busy's Avatar
    Join Date
    May 2004
    Location
    Richmond, VA, USA
    Posts
    819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But since the longest (English) word in the world is PNEUMONO&#173;ULTRA&#173;MICRO&#173;SCOPIC&#173;SILICO&#173;VOLCANO&#173;CONIOSIS
    we can safely say that the word size is going to be 45 or less characters, which is just short of infinity

    (I think you meant to say 26^infinity?)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •