Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 05-16-2009, 09:52 AM   #1 (permalink)
 
Newb Techie

Join Date: Aug 2007

Posts: 29

ninthBit is on a distinguished road

Default PHP Class destructors

Hi!
I have a question: I got a class with a constructor including infinite loop. it means then such class instance created, it should run until connection is lost and script is down by the server. I also have in-class destructor to do something then server stops script. As I supposed, PHP should call destructor for any instance and in this should execute destructors code and then let it stop. In real I have no destructor code executed, that means no destructor called on script shutdown. PHP manual says it should destruct all created instances and call their destructors on server external stop signal. Anyone knows what can i do?
ninthBit is offline  
Old 05-16-2009, 05:35 PM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: PHP Class destructors

to rephrase,

you have a script that loops forever. you want to add something to your class that will end the loops when the server says its stopping php.

i've never heard of a destructor before, but i think you're looking for garbage collection.
Php - Php Mysql - Garbage Collection Tutorials
office politics is offline  
Old 05-17-2009, 03:48 PM   #3 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: PHP Class destructors

I haven't yet mastered the OOP of PHP, but I don't believe destructors is what you want. Destructors are called when you release an object.

I think you'd be better off with an if statement to check if the connection is still open.
__________________

Need website help? PM me!
CrazeD is offline  
 
Closed Thread

« Php | beans »
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How echo works in PHP Osiris Programming Discussions 0 03-04-2009 08:34 AM
PHP - what it does and what it doesn’t Osiris Programming Discussions 1 02-16-2009 04:09 PM
Wev Development: How does PHP work? Osiris Programming Discussions 1 01-08-2009 04:31 PM
Tryed everything to get rid of virtumonde and failed elfullero HijackThis Logs (finished) 4 10-02-2008 09:43 AM
HJT Log bigdan HijackThis Logs (finished) 6 09-01-2008 06:49 PM