PHP - reversed order in if statement

前端 未结 7 1209
-上瘾入骨i
-上瘾入骨i 2021-01-12 01:19

This is a question that is bugging me for a long time and can\'t find any answer... Noticed it\'s used quite a lot by Zend Framework Developers,

What is the differen

7条回答
  •  执念已碎
    2021-01-12 01:57

    The result will be the same, however, the second is logical. You want to check if the variable is NULL, not if NULL is the variable... The reason for doing it the other way around is described here: http://umumble.com/blogs/Programming/321/

提交回复
热议问题