Backend Development 2 min read

PHP rand() Function – Generating Random Integers

The PHP rand() function returns a pseudo‑random integer within a given range, defaulting to 0 through getrandmax() when no parameters are supplied, and includes details on its parameters, return value, and usage examples.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP rand() Function – Generating Random Integers

The PHP rand() function returns a pseudo‑random integer between a specified minimum and maximum, or between 0 and getrandmax() when no arguments are given.

Parameters

min – The lowest value to return (default 0).

max – The highest value to return (default getrandmax() ).

Return value

A pseudo‑random integer between min (or 0) and max .

Example

backendPHPfunctionRandomrand
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.