Page 1 of 1

How to generate a random number in PHP?

PostPosted: Fri Sep 23, 2016 10:48 am
by ashi4275
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?

PostPosted: Tue Sep 27, 2016 5:43 am
by amar9450
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);
?>

Re: How to generate a random number in PHP?

PostPosted: Fri Feb 17, 2017 7:37 am
by addy657
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?

PostPosted: Sat Feb 18, 2017 6:43 am
by anna1462
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.