if (strlen($user_name) < $user_name_min_chars) {
    $errors[] = "Username must be at least {$user_name_min_chars} characters.";
}
if (preg_match('/\\s/', $user_name)) {
    $errors[] = 'Username should not contain spaces.';
}
if ($email != $conf_email) {
    $errors[] = 'Your emails do not match';
}
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
} else {
    $errors[] = 'Your email is invalid';
}
//create a new checkPwd object, and call various related functions.
//this is based on David Powers' code from 2nd edition of PHP solutions.
$check_password = new checkPassword($user_password, 8);
$check_password->requireMixedCase();
$check_password->requireNumbers(2);
//$check_password->requireSymbols();
$password_OK = $check_password->check();
if (!$password_OK) {
    $errors = array_merge($errors, $check_password->getErrors());
}
if ($user_password != $conf_user_password) {
    $errors[] = "Your passwords don't match.";
}
if (!$errors) {
    //no errors found, registration can be inserted to DB
    echo "yay no errors, let's process that info now! <br />";
    //for troubleshooting only
    $conn = dbConnect('admin');