does the condition after && always get evaluated

后端 未结 6 730
予麋鹿
予麋鹿 2020-12-03 02:48

I have this if statement that tests for the 2 conditions below. The second one is a function goodToGo() so I want to call it unless the first condi

6条回答
  •  臣服心动
    2020-12-03 02:58

    Yes, the 2 code blocks you gave are equivalent. PHP has short-circuiting, so when you use || and &&, any statement after the first only gets evaluated when necessary.

提交回复
热议问题