php random number

Discussion in 'Web Design & Coding' started by Leo154, Jun 11, 2003.

  1. Leo154

    Leo154 Guest

    how can i make the actual source to generate a random number?

    like

    Code:
    <body class="backgroundX">
    where X is the random numer.
     
  2. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
  3. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    PHP:
    <?php
      
    print rand(1,10);
    ?>
    That will give you a number between 1 and 10 :)
     
  4. Henyman

    Henyman Secret Goat Fetish Political User

    if you want a random back ground i can help as it would use the same php as in my sig :D
     
  5. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    No it wouldnt.... and who's PHP is that anyway...hmmm :p
     
  6. Henyman

    Henyman Secret Goat Fetish Political User

    it could use the same/very similar code? it chooses a random number + uses the coresponding image, i dont see why it could pick a random background instead.


    i got it from Geffy :p
     
  7. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    And geffy got it from me! :D

    For what leo wants I've already posted perfectly suitable code.
     
  8. Leo154

    Leo154 Guest

    okay thanks everyone, speedyb's way works fine. :D
     
  9. Henyman

    Henyman Secret Goat Fetish Political User

    thats good 2 hear :D