lundi 16 avril 2018

Bunch of if conditions - simplified?

How can I a bunch of my if conditions simpler?

For example:

statments:

condition 1: $row['age'] > 5;
condition 2: $row['id'] > 10;
condition 3: $row['number'] == '100';
condition 4: $row['gender'] == 'male';
condition 5: $row['state'] == 'New York';

How can i do something like this: if two of the conditions above exists, echo "welcome"? I was thinking about using an array? Maybe something else would be better?

if(two of the conditions above are true) {
    echo "Welcome";
}

Aucun commentaire:

Enregistrer un commentaire