How do I write this if statement correctly so that the "||" works? || represents "or" by the way. When i take out "|| >30" I receive no syntax error. But when I do include "|| >30" I receive a syntax error saying that ">" is unexpected.
if (strlen($_POST['password']) < 7 || >30){
$errors[] = 'Your password must be 7 to 30 characters long.'
if (strlen($_POST['password']) < 7 || >30){
should be this I presume:
if (strlen($_POST['password']) < 7 || strlen($_POST['password']) > 30){
Since you asked for a shorter version of this this is the simplest way using the same logic and functions:
$length = strlen($_POST['password']);
if ($length < 7 || $length > 30){
I think the only way to make it easier is to store your password length in a variable like this:
$pwd_len = strlen($_POST['password'])
if ($pwd_len < 7 || $pwd_len > 30){
This maybe not useful in your case but will be helpful when you need to refer to your password length many times. So it will save you a lot of time instead of always write strlen($_POST['password'])
Maybe I'm wrong but hope it helps :)