17 of 110 menu

PHP Random Number Generation

To generate random numbers in PHP, use the mt_rand function.

Let's generate a random number from 1 to 10 as an example:

<?php echo mt_rand(1, 10); ?>

Note that the value changes each time you refresh the page.

English
БеларускаяEspañolРусский
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline