I want to have a random number between 1 and 100 display on my page... how do I get this without using javascript!
Thanks to all who help!
I want to have a random number between 1 and 100 display on my page... how do I get this without using javascript!
Thanks to all who help!
Code:<?php echo rand(0, 100); ?>
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
K thnx! so if i wanted to turn this into a variable i would do this:
Would that be right?Code:<?php $rand = rand(0, 100); ?>
Thanks for the quick response
Yeah that works I just tried it THANKS SO MUCH!!!!!!!!!!!!
Last edited by Rockonmetal; 09-15-2007 at 06:13 PM.
You could also use mt_rand() for better random numbers between what you specify.
Hope this helps.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Isn't a random number between 0 and 100 a random number between 0 and 100? How is one random number better than another?
Thou com'st in such a questionable shape
Hamlet, Act 1, Scene 4
Oh i'm using it for the random math problem of the day... also i will use it to ask a math question to check if it is a computer filling out the form or a human... *or just to do something random...*
Bookmarks