Re: register_shutdown_function

From: Date: Mon, 15 Apr 2002 11:18:38 +0000
Subject: Re: register_shutdown_function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92987@lists.php.net to get a copy of this message
afaik there is no way to call a class method with register_shutdown_function. simply use a function which calls your constructor function _shutdown() { xmysql::~xmysql(); } register_shutodown_function("_shutdown"); "Hayden Kirk" <hayden90@ihug.co.nz> schrieb im Newsbeitrag news:000501c1e40b$694cab50$62e7adcb@relic... > im trying to make a distructor for a mysql class to kill the connection when > the object is destroyed using register_shutdown_function("~xmysql"); if i > put that in my class will it do that or am i getting confused. ~xmysql is a > destructor function i made. Heres the code, will it work how i want it to? > > class xmysql { > > var $id; > > register_shutdown_function("~xmysql"); > > function xmysql() { > $id = mysql_connect(localhost,'mystic','cqr73chw'); > or die("Could not connect to MYSQL database"); > } > function ~xmysql() { > mysql_close($id); > } > function GetID() { > return $id; > } > } // end xmysql >

« previous php.general (#92987) next »