Re: [PHP] Emulating a class destructor

2002-06-11 Thread Lars Torben Wilson
On Tue, 2002-06-11 at 23:21, William_dw -- Sqlcoders wrote: Hi there!, I'm trying to emulate a class destructor, according to the PHP documentation I can emulate this by using a call to register_shutdown_function(), containing the function to be called upon shutdown. While this apparently

Re: [PHP] Emulating a class destructor

2002-06-11 Thread Tom Rogers
Hi One way is to create an external reference to your class and use that in the cleanup function. To make the cleanup function visible it has to be declared inside the constructor (which makes it invisible to the rest of the class:) This is how I have done it: ? $ref = array(); class cRoute{

Re: [PHP] Emulating a class destructor

2002-06-11 Thread Lars Torben Wilson
On Tue, 2002-06-11 at 20:12, Tom Rogers wrote: Hi One way is to create an external reference to your class and use that in the cleanup function. To make the cleanup function visible it has to be declared inside the constructor (which makes it invisible to the rest of the class:) This is

Re: [PHP] Emulating a class destructor

2002-06-11 Thread Tom Rogers
At 01:18 PM 12/06/2002, Lars Torben Wilson wrote: On Tue, 2002-06-11 at 20:12, Tom Rogers wrote: Hi One way is to create an external reference to your class and use that in the cleanup function. To make the cleanup function visible it has to be declared inside the constructor (which makes

Re: [PHP] Emulating a class destructor

2002-06-11 Thread Tom Rogers
Hi A revised cleanup function for multiple instances of the same class. ? $ref = array(); class cRoute{ var $txt; //identify the class function cRoute($txt=){ global $ref; $x = count($ref); //get an index $this-txt =

Re: [PHP] Emulating a class destructor

2002-06-11 Thread Tom Rogers
Hi It was the register_shutdown_function(array($this, 'cleanup')); syntax that had me stummped and looking for magic :) Tom snip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Emulating a class destructor

2002-06-11 Thread Lars Torben Wilson
On Tue, 2002-06-11 at 22:27, Tom Rogers wrote: Hi It was the register_shutdown_function(array($this, 'cleanup')); syntax that had me stummped and looking for magic :) Tom Yeah, that needs to be explained a little better...hopefully I'll have time to fix up that page in the next few

Re: [PHP] Emulating a class destructor

2002-06-11 Thread Lars Torben Wilson
On Tue, 2002-06-11 at 22:01, Tom Rogers wrote: Hi A revised cleanup function for multiple instances of the same class. ? $ref = array(); class cRoute{ var $txt; //identify the class function cRoute($txt=){ global $ref; $x =