/ PHP
This simple function generates a random password using all alphanumeric characters. While this won't be the most secure password, it is better than a dictionary word. The function accepts an integer to determine the password length, but if one isn't passed defaults to 16.
function password_generator($length = 16)
{
$str = 'abcdefghijkmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
for ($i = 0, $password = ''; $i < $length; $i++) {
$password .= substr($str, mt_rand(0, strlen($str) - 1), 1);
}
return $password;
}

Clive Walkden
Latest Articles

Linux —
Terraform InstallationA quick installation guide for Terraform on Ubuntu 18.04

Clive Walkden
Author

Bitcoin —
RollerCoin IntroAn introduction to the RollerCoin site and how you can use it to mine your own coins

Clive Walkden
Author

Magento 2.4.x Writing to a Log File
How to log to information to a file in different Magento 2.4.x versions

Clive Walkden
Author