Here’s the translation of the Go code example to PHP, formatted in Markdown suitable for Hugo:
PHP’s mt_rand() and mt_getrandmax() functions provide pseudorandom number generation.
Some of the generated numbers may be different when you run the sample.
See the PHP manual for references on other random quantities that PHP can provide.
In PHP, we use the Mersenne Twister algorithm for generating random numbers, which is considered to be a good pseudorandom number generator. The mt_rand() function is generally preferred over the older rand() function for its better statistical properties.
Note that for cryptographically secure random numbers, you should use the random_int(), random_bytes(), or openssl_random_pseudo_bytes() functions instead.