PHP -- Regular Expressions

I am trying to do a regular expression that will return statement 1 (Help) if the password is less than 8 characters. Please help… I think it’s in my if statement.

$Password = “asyghkkjuhyygrrefg”;
echo $Password;
if (preg_match("/^[\w]+n(?=.{0,6}).*$/", $Password) ===1) {
echo “

Help</>”;
else
echo “

oops!

”;
}

The error says I have an “unexpected else.”

Thanks!

the else should be } else {

if all u want to do is check the string length, use strlen()

Sponsor our Newsletter | Privacy Policy | Terms of Service