Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • but what if he wants to have more than one instance of that class? a singleton is unnecessary here. Commented Feb 11, 2010 at 20:35
  • Read his question again. He specifically asks "is there a way to access one instance of a class inside functions in php" Commented Feb 11, 2010 at 20:38
  • 1
    And like I already said in the answer, just a small link you should follow and decide for yourself if singleton is really the right way: code.google.com/p/google-singleton-detector/wiki/… Commented Feb 11, 2010 at 20:46
  • 1
    True, he should indeed first look at all the options and decide whether or not the singleton approach is the way to go, but that exercise is left to the poster of the question. It's not something I can decide for him... Commented Feb 12, 2010 at 8:07