SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: random events?

  1. #1
    SitePoint Enthusiast ErikN's Avatar
    Join Date
    Jul 2001
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    random events?

    how could i use random() to setoff random events..or is there something else that could setoff random events?

  2. #2
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php isn't really an event driven programming language....that's to say that, once the code is executed, it's done. It doesn't lie in wait for a click or something.


    You have to exectute it by actually going and getting it. If you want something to wait around for an event, or you just want a random event to happen once in a while, look into JavaScript.
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  3. #3
    SitePoint Enthusiast ErikN's Avatar
    Join Date
    Jul 2001
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually, i just figured something out... i could do:
    PHP Code:
    $bla random(15);

    if (
    $bla == 1) {
    echo 
    "hi!";
    }
    if (
    $bla == 2) {
    echo 
    "howdy!"
    }
    if (
    $bla == 3) {
    echo 
    "hello!";
    }
    if (
    $bla == 4) {
    echo 
    "hiya!";
    }
    if (
    $bla == 5) {
    echo 
    "hola!";


  4. #4
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


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
  •