public static function random_password($length = 10) { $password = ''; $character_set = '1234567890!@#$^*qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVNBM'; $data = str_split($character_set); for ($i = 0; $i < $length; $i++) { $password .= $data[rand(1, strlen($character_set)) - 1]; } return $password; }