![]() |
Unsetting an object from within itself
This may be pretty basic, but I can't think of how right now. I'm wondering if I can unset an object when a specific method is called (no, not __destruct, I don't want to have to unset() it for the method to do what it needs to do). I've been playing around with building a small template class so that I can remove all email message bodies from the program logic and have them placed in seperate .tpl files, along with some common menu's etc. So when I call my class, I do something to this effect;
PHP Code:
$pTmpl object when parse() is called, instead of calling unset($pTmpl); after the fact - sounds lazy? Probably, but I'm just curious if I can do it.-m |
You can put a call to the destructor in the parse method (after you've done what you needed).
|
Yeah I thought of and tried that, and while I can define a destructor to clear all the properties data, it still doesn't destroy the object. I guess it's not a big deal to just unset the darned thing. :)
-m |
| All times are GMT. The time now is 07:16 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0