Reply to destructor not called for static members?

Your name:

Reply:


Posted by Robert Janeczek on 09/29/52 11:10

am i missing something or destructor isn`t called for objects that are
assigned to static fields in other objects? here is some example code:
<?php
class c1 {
public function __destruct() {
echo '__destruct';
}
}

class c2 {
private static $_ref;

public function __construct() {
self::$_ref = new c1();

//$this->_ref = new c1();
}
}

$obj = new c2();
unset($obj);
?>

i thought this should display __destruct in both cases from
c2::__construct, but only the one with non static access seems to call
c1::destruct. and if i remove unsetting $obj from the end of code this
one also doesn`t work. is it expected behaviour? or maybe when
__destructor is called after script finishes execution than output is no
longer possible? i tried also send some information to file and this
also didn`t work. help please :)

php 5.0.3

rash

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация