PHP Classes

File: randompassword.php

Recommend this page to a friend!
  Classes of Naveen valecha  >  Random Pass  >  randompassword.php  >  Download  
File: randompassword.php
Role: Class source
Content type: text/plain
Description: randompassword.php
Class: Random Pass
Generate a random text string with a given length
Author: By
Last change: Changed the code due the this error http://www.phpclasses.org/discuss/package/8410/thread/1/
Date: 8 years ago
Size: 410 bytes
 

Contents

Class file image Download
<?php

/**
 * The class is use to generate a random password.
 * @author Naveen Valecha<valecha29@gmail.com>
 */

class RandomPassword {

  protected
$password;

  public function
password($length) {

   
$string = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*';
   
$this->password = substr(str_shuffle($string), 0, $length);
    return
$this->password;
  }
}
?>