Sr. PHP Programmer Question:
Download Questions PDF

What is the use of rand() in php?


It is used to generate random numbers. If called without the arguments it returns a pseudo-random integer between 0 and getrandmax(). If you want a random number between 6 and 12 (inclusive), for example, use rand(6, 12).
This function does not generate cryptographically safe values, and should not be used for cryptographic uses. If you want a cryptographically secure value, consider using openssl_random_pseudo_bytes() instead.

Download Senior PHP Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
What does ob_start do?How we can retrieve the data in the result set of MySQL using PHP?