You can use in_array:
var_dump(in_array($a, [$b, $c]));
with your example:
echo in_array($a, [$b, $c]) ? 'Yes' : 'No';
Note: this syntax is only useful if there are more than two values. For a few values, it $a == $b || $a == $cworks well and is probably faster.
source
share