<?php function makePassword($length = 8) { $allowed_symbols = "23456789abcdeghkmnpqsuvxyz"; $allowed_symbols .= "ABCDEFGHJKLMNPQRSTUVWXYZ"; $password = "; for($i=0; $i<$length; $i++) { $password .= $allowed_symbols{mt_rand(0, strlen($allowed_symbols)-1)}; } return $password; } print_r(makePassword()."n");