Possible Duplicate:
Short hand to do something like: if($variable == 1 || $variable == “whatever” || $variable == '492') .
Is this
if ($a==b||$a==c||$a==$d){ ...
the shortest way to describe this logic. I am thinking about something like
if ($a==($b||$c||$d)) { ...
but that is not a valid code. Any suggestions?
You could use in_array:
if( in_array($a, array($b,$c,$d)) ){
//do something
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With