Is there any benefit of using null first in PHP?

后端 未结 5 1758
长发绾君心
长发绾君心 2020-12-11 15:42

Possible Duplicate:
Why do some experienced programmers write comparisons with the value before the variable?

5条回答
  •  攒了一身酷
    2020-12-11 16:19

    This is mainly to prevent accidental assignment:

    if (self::$_instance = null) ... //oops!
    

提交回复
热议问题