vendredi 27 janvier 2017

if statement for multiple string variables - check for two valid values out of five strings

I have 5 string variables ($a, $b, $c, $d, $e)

What I am trying to do is check if more than 2 of the variables are empty. [$x == ' ']

Here is what I have started with which will test if 1 or more of the variables are equal to ' ': if ($a == '' || $b =='' || $c =='' || $d =='' || $e ='')

But want I want to do is check if any 2 or more of the variables equal ' '

I know there must be a better way than elseifs for every iteration.
a, b, c, d, e
a, b, c, d, e
a, b, c, d, e
a, b, c, d, e
etc....

Any help would be hugely appreciated.

Aucun commentaire:

Enregistrer un commentaire