if statement - PHP Conditionals: is_null($someVariable) vs. $someVariable === 0 -


i debugged problem had root mention down here:

the first conditional true; second conditional not execute;

why 2nd conditional not execute?

$somevariable = 0;  if ( $somevariable === 0 ) var_dump('worked');  if ( is_null($somevariable) ) var_dump('worked too'); 

i think saw working in 'legacy' code, not sure it.

from is_null docs:

returns true if var null, false otherwise.

the second conditional doesn't execute because $somevariable isn't null.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -