mardi 5 février 2019

Is there a way to state multiple conditions associated with another condition as a whole?

I am trying to consolidate a few different if statements. What I am trying to accomplish would read something like this:

If (this is true and this is true) OR (this is true and this is true) AND (This is true)

So, one at least one of the first two sets of parentheses would need to be true, and if one of those is true, then also the last set of parentheses would need to be true, in order for the code inside to be executed.

Here is the specific code I am (unsuccessfully) trying to make work:

 if(($calc->number % 2 == 1 && $calc->doubleColor == 'b2' | $calc->number % 2 == 0 && $calc->doubleColor = 'r2') && in_array($calc->number, $backToBet)){

  }

Is there a way to do this? A possibility? Is there any drawback to getting a lot into a single if statement?

Aucun commentaire:

Enregistrer un commentaire