Question: I've got four variables, and if any two or more of them return true, I need to throw an error. I could technically do something like this:

`if (($var1 && $var 2) || ($var1 && $var3) || ($var1 && $var 4) ... || ($var4 && $var3))`, but that gets super complex and hard to manage. I imagine there's got to be a better way to do this.

Thanks.

Answer: 
Beste way is to use an array and loop through the array.

```
$my_vars = array($var1, $var2, $var3, ...);
$test_var = 'something';
$hits = 0;
foreach($my_vars as $var) {
    $hits = $var == $test_var ? $hits++: $hits;
    if($hits >= 2) {
        throw new Exception('This is bad dude...);
    }
}

```
Type casting & simple summation of four variables 

```
$a = "aaa"; $b = true; $c = false; $d = 1;

if((bool)$a + (bool)$b + (bool)$c + (bool)$d > 2)
    print "Error!";

```