Reply to Re: Shutdown order

Your name:

Reply:


Posted by Jerry Stuckle on 11/16/06 18:42

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@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация