PHP - 构造函数不返回 false
2022-08-30 17:44:18
我怎么能让下面的变量知道foo应该是假的?$foo
class foo extends fooBase{
private
$stuff;
function __construct($something = false){
if(is_int($something)) $this->stuff = &getStuff($something);
else $this->stuff = $GLOBALS['something'];
if(!$this->stuff) return false;
}
}
$foo = new foo(435); // 435 does not exist
if(!$foo) die(); // <-- doesn't work :(