What happens if you call a constructor from a destructor?

依然范特西╮ 提交于 2019-12-02 13:34:58

No, but this will:

class Test {

    public function __construct() {
        echo "Hi";
    }

    public function __destruct() {
         new Test();
    }

}

new Test();

Example: http://ideone.com/94XUg

No, it won't. __construct is just regular function while called directly instead of using new ClassName;

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!