Excuse me, but I don't understand what you mean by "more proffesional". How does one rate the "proffesionalness" of a PHP code snippet?
Anyway, in my view it would be much simpler to have the close method called automatically (by default, with the option to turn it off for custom close positions) than relying on the developer to always place it at the end of the script. Plus, the person learning from the article could then see where and why the register_shutdown_function function is useful.
What could be simpler than adding $Cache = new Cache(); to the top of the page and leaving it at that?
|