dimanche 30 août 2015

if elseif else statement

What is the substantial differences between these if-else, if-elseif-else statements:

if (condition 1) {
    die();
}
elseif (condition 2) {
    die();
}
else {
    code;
}

,

if (condition 1) {
    die();
}
elseif (condition 2) {
    die();
}
elseif (!condition 1 && !condition 2) {
    code;
}
else {
    die();
}

and

if (!condition 1 && !condition 2) {
    code;
}
else {
    die();
}

where condition 1 and condition 2 are, for example, empty($var)?

Aucun commentaire:

Enregistrer un commentaire