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" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
000501c1e40b$694cab50$62e7adcb@relic">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
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to