Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Random numbers please!
Old 06-22-2009, 04:04 PM Random numbers please!
Junior Talker

Posts: 3
Name: Samuel Liljekvist
Trades: 0
Anyone that can tell me how to get a random number created when someone fills in a form. The number should be sent to the customer and to the person who filld out the form. (the same number )

I´m very gratefull for any suggestions!
__________________
Visit my home:
Please login or register to view this content. Registration is FREE
Aixenpro is offline
Reply With Quote
View Public Profile Visit Aixenpro's homepage!
 
 
Register now for full access!
Old 06-22-2009, 05:01 PM Re: Random numbers please!
Experienced Talker

Posts: 45
Trades: 0
Quote:
Originally Posted by Aixenpro View Post
Anyone that can tell me how to get a random number created when someone fills in a form. The number should be sent to the customer and to the person who filld out the form. (the same number )

I´m very gratefull for any suggestions!
<?
srand(time());
$random = (rand()%9);
print("random number between 0 and 9 is: $random");
?>
__________________

Please login or register to view this content. Registration is FREE
dan101 is offline
Reply With Quote
View Public Profile
 
Old 06-22-2009, 05:20 PM Re: Random numbers please!
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
Originally Posted by dan101 View Post
<?
srand(time());
$random = (rand()%9);
print("random number between 0 and 9 is: $random");
?>
As of PHP 4.2 it is no longer necessary to seed your random number generator (it is done automatically). Also, rand accepts min and max parameters (inclusive) so you don't have to use modulos.

PHP Code:
echo 'random number between 0 and 9 is: ' rand(9); 
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to Random numbers please!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11328 seconds with 12 queries