public static function randomPassword($length = 8, $string = null) {
        if (!$string)
            $string = 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ123456789&^%$#@!_-+=';
        $chars = str_split(str_shuffle($string));
        $password = '';
        foreach (array_rand($chars, $length) as $key) {
            $password .= $chars[$key];
        }
        return $password;
    }
public static function randomPassword($length = 8, $string = null) {
        if (!$string)
            $string = 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ123456789&^%$#@!_-+=';
        $chars = str_split(str_shuffle($string));
        $password = '';
        foreach (array_rand($chars, $length) as $key) {
            $password .= $chars[$key];
        }
        return $password;
    }
public static function randomPassword ( $ length = 8 , $ string = null ) { if ( ! $ string ) $ string = 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ123456789&^%$#@!_-+=' ; $ chars = str_split ( str_shuffle ( $ string ) ) ; $ password = '' ; foreach ( array_rand ( $ chars , $ length ) as $ key ) { $ password .= $ chars [ $ key ] ; } return $ password ; }
Generates a random password
@param int $length Length of the password to generate. Default is 8
@return string
Generates a random password