Some coding guidelines indicate that you should put the variable that you are testing at the end of the condition:
if($isSomething === FALSE) {
if(FALSE === $isSomething) {
I know that some programmers have a bad habit of initializing variables in such conditions:
if($results = $db->getResults() {
Therefore, the only reason I could suggest that this contradictory rule is to prevent incorrect reinvaluation if you accidentally use only one equal sign (=) instead of two in PHP.
Are there any other reasons?
source
share