1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Randomize Data in An Array

Discussion in 'PHP' started by qdsouza, Aug 31, 2005.

  1. #1
    I am just learning php and am trying to randomize data in an array. I am creating a bingo card script that will allow teachers to create a bingo card from words that the enter in a form.

    What I would like to do is randomize the words that were entered in the form, that I placed into an array.

    
    $wbingo = array('$word','$word1','$word2','$word3','$word4', '$word5', '$word6', '$word7', '$word8');
    
    PHP:
    That way I can randomize the words on the bingo board. In this case I have 9 words, I will also have a card with 25 words. Any ideas would be appreciated.

    Thanks
     
    qdsouza, Aug 31, 2005 IP
  2. qdsouza

    qdsouza Guest

    Messages:
    20
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think this does it? - good ol'google.

    
     $wbingo = array('$word','$word1','$word2','$word3','$word4', '$word5', '$word6', '$word7', '$word8'); 
    shuffle($wbingo);
    
    PHP:
     
    qdsouza, Aug 31, 2005 IP
  3. bamb0lin

    bamb0lin Well-Known Member

    Messages:
    401
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #3
    yes it will do the job.

    qdsouza if you are a newbie and would like to learn php i suggest you www.snippetcollection.com You can find interesting examples that you will learn from them. Updated daily!
     
    bamb0lin, Sep 1, 2005 IP
  4. qdsouza

    qdsouza Guest

    Messages:
    20
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for the link I bookmarked it.

    I bought Larry Ulman's "Php for the world wide web" and am taking online php courses through VTC canada. I like learning by doing new projects. I am learning but I'm trying to find a forum that well help support noobies. I'm not sure if this forum is just for experts.
     
    qdsouza, Sep 1, 2005 IP
  5. carowan

    carowan Peon

    Messages:
    473
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I used the same code to randomize some links on the bottom of the pages of the sites in my sig. Works well.
     
    carowan, Sep 1, 2005 IP
  6. bamb0lin

    bamb0lin Well-Known Member

    Messages:
    401
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #6
    bamb0lin, Sep 1, 2005 IP