How do I successfully construct the following pseudocode IF clause in php ?
if $a is NOT equal to 'B'
OR
if $a is NOT both a string AND equal to 'C' or 'D'
continue
Just to clarify the second clause
- if $a is equal to C or D but not a string, it continues
- if $a is not equal to C or D even if it is a string, it continues
- only if $a is equal to C or D AND a string it does not continue
This are my attempts, but I am not negating correctly the second clause
if ( ($a != 'B') OR !(in_array($a, array("C", "D")) AND is_string($a) ) ) {
...
}
and
if ( ($a != 'B') OR (!is_string($a) AND in_array($a, array("C", "D")) ) ) {
...
}
Thank you
Aucun commentaire:
Enregistrer un commentaire