I have a conditional statement that goes like this:
if ($_POST['password'] == $_POST['repeat'] && $_SESSION['type'] == "admin")
But let's say I also want the conditional value true for users with the type "superuser" (instead of "admin").
Therefore, I could, for example, write:
if ($_POST['password'] == $_POST['repeat'] && $_SESSION['type'] == "admin" || $_SESSION['type'] == "superuser")
But if we assume that PHP reads conditional expressions and equations from left to right, then for the "superuser" it is possible for the conditional result to be evaluated as true, even if the "password" and "repeat" are not equal, since we place imaginary brackets around the two operands next to "& &", right?
I could add brackets to encapsulate the two operands for "||", but I remember a little that I might have tried something in the past, and if it were ineffective.
Is there a better way to do this? Do the brackets really work (so the conclusion is that my memory is defective?) [Memory leak? Heh.])
Thanks!
source share