Password / random string generator

$characters = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789!@#$%^&*()';

$len = strlen($characters) - 1;

$password_length = 8;
$password = '';
for ($i = 0; $i < $password_length; $i++) {
  $password .= $characters[mt_rand(0, $len)];
}