My advice is to use switch/case -- which will actually run fastest of them too.
This is true in Pascal as well -- string sets are slow! (numerics aren't much better!).
switch ($animal) {
case 'cat':
case 'dog':
case 'mouse':
// do whatever it is yer doing here
}
case conditions fall through to each-other, so the above is the same as doing a bunch of ||
Oh, and in PHP don't use OR, it's logic is not what you think it is, stick to || -- trust me on this. The first time you hit up against "false or true = false, false || true = true" you'll be ripping your hair out... OR doesn't work like it does in pascal, as it will short circuit eval the first false.
You can also pass arrays as constants since PHP is an untyped language...
if (in_array($animal,['cat','dog','mouse'])) {
Would work too... though dog slow.
Not to bump a three year old post -- just bored
If everyone is thinking the same, somebody isn't thinking.