How to generate a random number in PHP?

General discussion on PHP

How to generate a random number in PHP?

Postby ashi4275 on Fri Sep 23, 2016 10:48 am

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.
ashi4275
 
Posts: 15
Joined: Fri Jul 15, 2016 10:02 am

Re: How to generate a random number in PHP?

Postby amar9450 on Tue Sep 27, 2016 5:43 am

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);
?>
amar9450
 
Posts: 11
Joined: Wed Aug 03, 2016 6:02 am
Location: USA

Re: How to generate a random number in PHP?

Postby addy657 on Fri Feb 17, 2017 7:37 am

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.
addy657
 
Posts: 1
Joined: Fri Feb 17, 2017 7:34 am

Re: How to generate a random number in PHP?

Postby anna1462 on Sat Feb 18, 2017 6:43 am

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.
anna1462
 
Posts: 1
Joined: Sat Feb 18, 2017 6:36 am
Location: London


Return to PHP

Who is online

Users browsing this forum: No registered users and 1 guest