Re: Shutdown order
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Thu, 16 Nov 2006 13:42:41 -0500
Thomas Mlynarczyk wrote:
Also sprach Jerry Stuckle:
It doesn't make any difference what order the functions are in - they
are only called when your code calls them directly or indirectly
(i.e. a constructor). So whatever order you call them in is the way
they will be called.
But I am not /calling/ these functions - it is PHP that decides when to call them. I am merely registering two functions and instantiating an object.
As for the variable - the object is destroyed, the destructor is
called. But that's not what's happening here. You are calling the
destructor, so it acts just like any other function.
Where am *I* calling the destructor in my code? I am merely /defining/ the function __destruct() and I leave it up to PHP to decide when it is to be executed.
Rather, the destructor is called implicitly during script termination
or when the variable goes out of scope. Like a constructor, you
should not be calling a destructor.
But I am not calling it! Where in my code do I have a line that says "$o->__destruct();"?
Greetings,
Thomas
Oops, I misread your code and your post.
No, you cannot rely on the order in which things are cleaned up. It is always subject to change.
This is no different than C++, Java or any other OO languages. The order in which things are cleaned up is never guaranteed.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- Re: Shutdown order
- From: Thomas Mlynarczyk
- Re: Shutdown order
- References:
- Shutdown order
- From: Thomas Mlynarczyk
- Re: Shutdown order
- From: Jerry Stuckle
- Re: Shutdown order
- From: Thomas Mlynarczyk
- Shutdown order
- Prev by Date: Re: application level database connection
- Next by Date: Re: Novice needs help :)
- Previous by thread: Re: Shutdown order
- Next by thread: Re: Shutdown order
- Index(es):
Relevant Pages
|