Pulpmedia IT DEV open source code

PHP Random Password Generator

A PHP class which can be used to generate random passwords.

By default the class generates one completely random password.
See the comments within the class file for a detailed description of all parameters. You also can easily adjust the character pools within the class.

Examples

example.php
source code of example.php
<?php

    
require_once('class.randomPassword.php');

    
// generate password with 4 lowercase letters, 2 uppercase letter,
    // 2 numerical character and 2 special character
    
$password = new RandomPassword(array(4121));
    
    
// display one random password
    
echo $password->generate().'<br />';

    
// display four apsswords separated by linebreak
    
echo implode('<br />'$password->generate(4));
    
?>

Download source files

Licenses

The licenses under which the source codes are released are:
license.txt