Create superglobal

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Create superglobal

Post by MarK (CZ) »

Hi!

I have one object which I use pretty often. Is there a possibility to make superglobal out of him - so that I wouldn't have to use global $object; in every function?
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

you cant make your own superglobal, but you can store its value in an existing one. $GLOBALS would prob be most suited.

$GLOBALS['object']
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

singleton maybe? Look for an example of this OOP pattern in the Code Snippets.
Post Reply