Hello,

This is a question relating to the new PHP5 Object Destructor functionality. Consider the following:

<?php

class DB
{
   function Query() { ... }
}

class Session
{
   function SetVar() {
      //sets a variable to be saved in the session
   }

   function __destruct() {
      //Save session variables in database using global $oDB object.
      global $oDB;
      $oDB->Query(...);
   }
}

$oDB = new DB();

$oSession = new Session();
$oSession->SetVar('foo', 'New Value');

//End of script
?>


Based on the above example, the $oSession->__destruct() method relies on the $oDB object still being usable. How can this be structured to ensure that the DB object does not get released first?


Thanks,
Jason



__________________________________________________________
Jason Garber
President & Chief Technology Officer
IonZoft, Inc.
814.742.8030 :: [EMAIL PROTECTED] :: http://IonZoft.com
__________________________________________________________

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to