What's the meaning of the reverse entry (null === $value) when checking the value of the variable?

if-statement, isnull, php

Solution

some people believe it helps them in avoiding to write a single `=` (an assignment instead of a comparison for equality)

I believe that the advantage of doing so is much less than the loss of readability (and therefore maintainability!)

People who don't test their code may rely on this sort of trick. And to answer your question, yes, it is suitable for most languages who derive their syntax from C - I mean suitable, not recommended.

Problem

Possible Duplicate: PHP - reversed order in if statement Checking for null - what order? Examining Zend Framework found that they do all the variable checkings reverse way: ``` public function setBootstrap($path, $class = null) { if (null === $class) { // instead of if($class === null) $class = 'Bootstrap'; } ``` What's the reason of doing this? Is this also suitable for Java and C++ programming?

Original source

Related problems