A simple way to create a random password in PHP



Author: Binny V A
A philosopher programmer who specializes in backend development and stoicism.

## 4 thoughts on “Random Password in PHP”

1. thankz for the code 😀
If I remove rand(4,8) or if I put rand (4,4) then it is generating unique password every second… can we over come it? (may be using something else instead of time() )

2. Try using microtime(). And you can just use 4 instead of rand(4,4). I used that to change the length of password randomly.

3. hmm says:

Nice snipped – but it is insecure as it will produce passwords only containing [a-f0-9]