Skip to content

Random number in PHP

Real quick little function to get a random number using PHP.

$x = rand(1,100);

The variable $x will contain a random number between 1 and 100.

It’s rand(min, max) if you don’t want to use 1 and 100 as your limits.

Published inProgramming

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *