What's the difference between if(!Variable) and if(isset($variable))?
if(!Variable)和if(isset($ variable))之间有什么区别?
Well, the answer is pretty simple. isset( $var ) returns whether or not a variable exists and is not null, where !$var tells you if that variable is true, or anything that evaluates to true (such as a string). Also, using !$var will output a notice that you're using an undefined variable, whereas isset won't do that.
Mind you: they are two different things:
<?php
var_dump( isset( $foo ) ); // false.
var_dump( !$foo ); // true, but with a warning.
$foo = false;
var_dump( isset( $foo ) ); // true
var_dump( !$foo ); // true.
如果没有设置变量,那么在使用if(!Variable)时会发出警告。
They are two different statements