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

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -