- Home
- Blog
- Contact
As I often work with APIs for our clients, I often need a simple password generator that creates a random password using numbers and letters, both lowercase and uppercase. The function below is a simple example.
// Generate a simple random password
function getRandomPassword($length = 8){
$data = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcefghijklmnopqrstuvwxyz';
return substr(str_shuffle($data), 0, $length);
}