= 8; $isUppercase = preg_match('/[A-Z]/', $value); $isNumber = preg_match('/[0-9]/', $value); $isSymbol = preg_match('/\!|\@|\#|\$|\%|\^|\&|\*|\-/', $value); if (!$isLength) { $fail('Password must be at least 8 characters large.'); } if (!$isUppercase) { $fail('Password must have capital letters.'); } if (!$isNumber) { $fail('Password must have number.'); } if (!$isSymbol) { $fail('Password must have symbol ! @ # $ % ^ & * -'); } } }