☆ P H P 5 ☆
■ このスレッドは過去ログ倉庫に格納されています
0104 ヽ(´ー`)ノ
03/07/19 10:12ID:???> The Zend Engine 2.0 introduces a destructor concept similar to
> that of other object-oriented languages, such as Java: When the
> last reference to an object is destroyed the object's
> destructor, which is a class method name __destruct() that
> recieves no parameters, is called before the object is freed
> from memory.
参照が無くなった時点でデストラクタがコールされて、その後メモリが開放されるみたい。
class A() {
public function __destruct() {
print "destruct\n";
}
}
function test() {
$obj = new A();
}
test();
print "Done.\n";
--出力
destruct
Done.
こんな感じ。
■ このスレッドは過去ログ倉庫に格納されています