samedi 3 août 2019

if condition with multiple booleans

Consider the following PHP code :

$someVar = false;

function someHeavySqlFunction() {
    // massive time/memory/cpu intensive SQL request here
    return true;
}

if ($someVar && someHeavySqlFunction()) {
    // blabla
}


Will my "if" condition run that "someHeavySqlFunction()" to see if it returns true/false? Or will it "stop" as soon as "it" notices that $someVar is already "false" so no "need to go further"?

Sorry but I could not find the proper keywords to find an answer to that very basic question.

Aucun commentaire:

Enregistrer un commentaire