Some coding guidelines state that you should put the variable you are testing at the end of the condition:
// Incorrect
if($isSomething === FALSE) { // Do something }
// Correct
if(FALSE === $isSomething) { // Do something }
I know that some programmers have the bad habit to initalize variables in conditions like that:
if($results = $db->getResults() { // Do something if results exist }
So the only reason I could imagine for having this counterintuitive rule is to prevent wrong reinitalisation in case you accidentally use just one equal sign (=) instead of two in PHP.
Are there any other reasons?
You can not accidentally assign a value in the case you wanted to compare.
This makes finding small errors much easier.
if (FALSE = $isSomething)will throw an error, as you can not reassign constantswheras
if ($isSomething = FALSE)will always return true and you will probably not notice that error for a long time.