Thursday, January 28, 2016

PHP RANDOM NUMBER: Generate Random Numbers in PHP

The following tutorial will introduce you to one of the most common problems encountered in programming subjects. Later on, I will provide set of activities and quizzes for you to practice on to improve your programming skills.
Some other exercises are the following:

5.     Fibonacci Series

and many more. These are just some of the activities that I posted here in my blog. You can visit the links if you want.

A random function rand() is used to generate random integer numbers. I already done posting article about generating random numbers in Java

Syntax for random number


or if you want to specify numbers from a certain range then you used this syntax

Syntax for random number with limit


The following php code will generate random numbers.

PHP Code Random Number Generator

echo rand();
while following php code will generate random numbers between 100-2000.

PHP Code Random Number Generator

echo rand(100,2000);

Possible Output Random Number Generator

101 / 507 / 1250 / 899 / 1999

Try our Random Number Generator in PHP Live Here!

Thank you for visiting and hope this helps you. Feel free to leave a comment below for any questions. I got some other articles related to php and mysql here in my blog. Watch out for more upcoming tutorials related to blogging and programming. Good day! ^_^

PHP RANDOM NUMBER: Generate Random Numbers in PHP

No comments:

Post a Comment