Page 1 of 1

Create superglobal

Posted: Thu Jan 27, 2005 9:00 am
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?

Posted: Thu Jan 27, 2005 9:09 am
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']

Posted: Thu Jan 27, 2005 9:11 am
by feyd
singleton maybe? Look for an example of this OOP pattern in the Code Snippets.