Random integer generator
min ,max : (Optional) Minimum and maximu value ( both inclusive ) of random integer to be generated ( both to be given )
We can generate random value by using rand() PHP. We can specify a range and the random value between those two ranges (inclusive) will be generated.
This output is not cryptographically secure values , so for cryptographically secure value, consider using random_int(), random_bytesNote that here we are generating a random number only. To get any random characters we can use arrays. The details on how to generate random characters is available here.
Random number of different lengthWe can create a script to generate random number of different length. Let us try to develop a script to print random number of 5 character length.
Here it is
Output is here
Read here how to generate random string having alphabets and digits
This article is written by plus2net.com team.