PHP logical operator [duplicate]











up vote
2
down vote

favorite
1













This question already has an answer here:




  • Does PHP have short-circuit evaluation?

    8 answers




When the isset() is executed the following check $_SESSION['mat'] == "1" is executed or the second verification is directly skipped since it is the first false?



Is there is where I have the doubt?



if(isset($_SESSION['mat']) and $_SESSION['mat']=="1"){}









share|improve this question















marked as duplicate by Nigel Ren php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 19 at 10:42


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















    up vote
    2
    down vote

    favorite
    1













    This question already has an answer here:




    • Does PHP have short-circuit evaluation?

      8 answers




    When the isset() is executed the following check $_SESSION['mat'] == "1" is executed or the second verification is directly skipped since it is the first false?



    Is there is where I have the doubt?



    if(isset($_SESSION['mat']) and $_SESSION['mat']=="1"){}









    share|improve this question















    marked as duplicate by Nigel Ren php
    Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Nov 19 at 10:42


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

















      up vote
      2
      down vote

      favorite
      1









      up vote
      2
      down vote

      favorite
      1






      1






      This question already has an answer here:




      • Does PHP have short-circuit evaluation?

        8 answers




      When the isset() is executed the following check $_SESSION['mat'] == "1" is executed or the second verification is directly skipped since it is the first false?



      Is there is where I have the doubt?



      if(isset($_SESSION['mat']) and $_SESSION['mat']=="1"){}









      share|improve this question
















      This question already has an answer here:




      • Does PHP have short-circuit evaluation?

        8 answers




      When the isset() is executed the following check $_SESSION['mat'] == "1" is executed or the second verification is directly skipped since it is the first false?



      Is there is where I have the doubt?



      if(isset($_SESSION['mat']) and $_SESSION['mat']=="1"){}




      This question already has an answer here:




      • Does PHP have short-circuit evaluation?

        8 answers








      php session if-statement logical-operators






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 19 at 12:56









      Funk Forty Niner

      80.4k124799




      80.4k124799










      asked Nov 19 at 10:35









      rai

      175




      175




      marked as duplicate by Nigel Ren php
      Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 19 at 10:42


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by Nigel Ren php
      Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 19 at 10:42


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          If the first part of your if statement already returns false the second part will not be evaluated. Your if statement looks good this way and shouldn't throw any index out of bounds errors.






          share|improve this answer




























            up vote
            0
            down vote














            When the isset is executed the following check is executed ($ _ SESSION ['mat'] == "1") or the second verification is directly skipped since it is the first false.




            isset() will check if a variable is set otherwise it will return false. All the code inside the if() statement will be executed, so in your case, if the $_SESSION array variable isn't set, the second control, in your case and (that can be expressed also using &&) will be skipped.






            share|improve this answer




























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              2
              down vote



              accepted










              If the first part of your if statement already returns false the second part will not be evaluated. Your if statement looks good this way and shouldn't throw any index out of bounds errors.






              share|improve this answer

























                up vote
                2
                down vote



                accepted










                If the first part of your if statement already returns false the second part will not be evaluated. Your if statement looks good this way and shouldn't throw any index out of bounds errors.






                share|improve this answer























                  up vote
                  2
                  down vote



                  accepted







                  up vote
                  2
                  down vote



                  accepted






                  If the first part of your if statement already returns false the second part will not be evaluated. Your if statement looks good this way and shouldn't throw any index out of bounds errors.






                  share|improve this answer












                  If the first part of your if statement already returns false the second part will not be evaluated. Your if statement looks good this way and shouldn't throw any index out of bounds errors.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 19 at 10:38









                  Dirk Scholten

                  574217




                  574217
























                      up vote
                      0
                      down vote














                      When the isset is executed the following check is executed ($ _ SESSION ['mat'] == "1") or the second verification is directly skipped since it is the first false.




                      isset() will check if a variable is set otherwise it will return false. All the code inside the if() statement will be executed, so in your case, if the $_SESSION array variable isn't set, the second control, in your case and (that can be expressed also using &&) will be skipped.






                      share|improve this answer

























                        up vote
                        0
                        down vote














                        When the isset is executed the following check is executed ($ _ SESSION ['mat'] == "1") or the second verification is directly skipped since it is the first false.




                        isset() will check if a variable is set otherwise it will return false. All the code inside the if() statement will be executed, so in your case, if the $_SESSION array variable isn't set, the second control, in your case and (that can be expressed also using &&) will be skipped.






                        share|improve this answer























                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote










                          When the isset is executed the following check is executed ($ _ SESSION ['mat'] == "1") or the second verification is directly skipped since it is the first false.




                          isset() will check if a variable is set otherwise it will return false. All the code inside the if() statement will be executed, so in your case, if the $_SESSION array variable isn't set, the second control, in your case and (that can be expressed also using &&) will be skipped.






                          share|improve this answer













                          When the isset is executed the following check is executed ($ _ SESSION ['mat'] == "1") or the second verification is directly skipped since it is the first false.




                          isset() will check if a variable is set otherwise it will return false. All the code inside the if() statement will be executed, so in your case, if the $_SESSION array variable isn't set, the second control, in your case and (that can be expressed also using &&) will be skipped.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 19 at 10:39









                          user9741470

                          658115




                          658115















                              Popular posts from this blog

                              If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                              Alcedinidae

                              Can an atomic nucleus contain both particles and antiparticles? [duplicate]