register_shutdown_function
| From: | Hayden Kirk | Date: | Sun, 14 Apr 2002 23:23:31 +0000 |
| Subject: | register_shutdown_function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-92949@lists.php.net to get a copy of this message | ||
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