Global instance of class
| From: | Silvia Mahiques | Date: | Wed, 21 Nov 2001 13:44:09 +0000 |
| Subject: | Global instance of class | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75379@lists.php.net to get a copy of this message | ||
Hello friends!
I want to access a global instance of a class from diferents php files. How
can I do this? Is it possible?
The code file (xxxx.php) that has this first reference is:
$global_var = new one_class();
If I include this file (xxxx.php) in another php file, a new instance is
created again, and I want a unique instance in all project.
If I put in a file (yyyy.php) the expression
global $global_var;
but without include file (xxxx.php), this global var is undefined.
Which is the solution?
Thanks, in advance.
Silvia Mahiques