How to generate a random number in PHP?
How to generate a random number in PHP?
Hi, I am a developer. I have been searching for best suited php development forums which provide helpful information on development, so that I can get help from their active members for learning how to generate a random number in PHP. I hope any tech developer can help me in resolving the issue or provide me links of such more forums.
Re: How to generate a random number in PHP?
You can use rand() for generate a random number in PHP.
Description:
int rand ( int $min , int $max )
Parameters
min
The lowest value to return (default: 0)
max
The highest value to return (default: getrandmax())
For Example :
<?php
echo rand() . "\n";
echo rand() . "\n";
echo rand(5, 15);
?>
Description:
int rand ( int $min , int $max )
Parameters
min
The lowest value to return (default: 0)
max
The highest value to return (default: getrandmax())
For Example :
<?php
echo rand() . "\n";
echo rand() . "\n";
echo rand(5, 15);
?>
Re: How to generate a random number in PHP?
All things considered, I believe it's impractical in PHP programming dialect since it's modifying dialect not Ajax and html 5 and so on, in light of the fact that this capacity conceivable by Ajax HTML 5 and other markup dialect. So it's unrealistic by PHP dialect.
Re: How to generate a random number in PHP?
Became thinking how to create a link to a ability random web page on my website. On xkcd's internet site for example the random comedian button hyperlinks to this dynamic.XkcdCom i was questioning how such navigation is done like this on these webcomics.