Possible Duplicate:
Why do some experienced programmers write comparisons with the value before the variable?
I am just curious about this: in most frameworks/opensource projects I have studied, I often seen code like this...
<?php
if (null === self::$_instance) {
self::$_instance = new self();
}
In particular this line...
if (null === self::$_instance) {
Why use null
in the first argument of the if
statement instead of the other way around?...
if (self::$_instance === null) {
I realize there is probably no performance increase or anything like that. Is this just a preference or is it some kind of coding standard I have overlooked?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…