By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,406 Members | 1,537 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,406 IT Pros & Developers. It's quick & easy.

Static classes vs. singleton classes vs. globals

P: n/a
Sometimes I want to use certain data and functions anywhere in my code;
for example, when writing logging routines. In PHP5 I could write a
class with all static members and functions, a singleton class, or a
regular class assigned to a global variable. What would be the
advantages of each?

In Java web-apps (or in non-web applications), these classes persist
for much longer, so it's easier to see the reasons for using them. But
in PHP, it seems like you could do pretty much the same thing with all

Am I wrong?

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.