Using more than one OR Operator in an If Statement
I'm trying to do an IF statement with 4 conditional. It doesn't seem to be working though and to be honest I'm not sure if you should be able to make something like this work?
I'd like the text in the if block to show if any one of these conditions are met but at the moment it's only picking in the first two.
if(($message[to] == "") || ($person == $message[to]) || ($name == $person)开发者_StackOverflow社区 || ($user[group] == "admin")){
echo "This is a test";
}
Thank you!
Use it like this:
if((empty($message['to'])) || ($person == $message['to']) || ($name == $person) || ($user['group'] == "admin")){
echo "This is a test";
}
Also use a print_r($message), print_r($user), etc to see if they really have the values you think.
精彩评论