I was trying out a PHP “if” statement in which I want two things to be true: that $myvar is equal to 1 and that $myvar2 is equal to 2. However when I tried this:
if($myvar=='1', $myvar2=='2') {
header("location:index.php");
}
It failed to work. Is there a way to set up one if statement to contain these two variables like I have presented?
Thank you
You can use the boolean AND operator (&&)
Here’s a full list of operators: http://php.net/manual/en/language.operators.logical.php