Is destructor in PHP predictable?

前端 未结 2 1791
旧巷少年郎
旧巷少年郎 2021-01-18 06:37

Is a class destructor in PHP predictable? When is the destructor called?

Like in many languages, will a class destructor be called as soon as the object goes out of

2条回答
  •  走了就别回头了
    2021-01-18 06:55

    PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++. The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence.

    http://php.net/manual/en/language.oop5.decon.php

提交回复
热议问题