mardi 31 juillet 2018

Adding numbers together as a result of an if statement

So I'm looking to add numbers to a string as a result of an if statement. For example;

a = 2;
b = 1;
  if($a == 2) {
     $total + 1;
    }
     if($b == 1) {
     $total + 1;
    }
    echo $total;

Obviously, these aren't my if statements but if they were to work then I would like $total to = 2? This seems sort of simple but I can't work it out?

Aucun commentaire:

Enregistrer un commentaire