PHP: If a equals b or c or d

if-statement, php

Solution

You could use in_array:

if( in_array($a, array($b,$c,$d)) ){
    //do something
}

Problem

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?

Original source

Related problems