Is using php destructor appropriate for displaying HTML?

soakk

New Member
If a class is implemented that builds HTML for a page by constructing it and calling various methods, is it appropriate to define the display/echo part of the class within the destructor? Instead of having a explicit \[code\]Class:displayHTML();\[/code\] method, having the \[code\]echo $this->html\[/code\] in the destructor and whenever you are ready to display call \[code\]unset($object);\[/code\] which would display it? I know the destructor probably is not the best place for this but wonder what others thoughts are on this?
 
Back
Top