Multiple if... questions? in the statement

A

Anonymous

Guest
I'm trying to check for multiple entities, and if any of them exist, to do a further check. I was wondering if I could do this in one statement.

Full way:
Code:
if($model == "dodge" && $year == "2001" || $model == "ford" && year == "2001" || $model == "oldsmobile" && $year == "2001")

I was wondering if I could do something like:
Code:
if(($model == "dodge" || $model == "ford" || $model == "oldsmobile") && $year == "2001")

Clearly I realize I can't do the later, but I was wondering if there was something comparable that I could do that would accomplish the same thing.

Thank you for your input.
 
Code:
if((in_array($model,array("dodge" ,"ford","oldsmobile")) && $year == "2001")
look for in_array() function from the manual for more explanation
 
Back
Top