global class instance
| From: | sempsteen | Date: | Sat, 01 Jul 2006 09:56:16 +0000 |
| Subject: | global class instance | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-239044@lists.php.net to get a copy of this message | ||
hi all,
i wonder if there is a way of creating an instance of a class and
reach it direcly from any scope in PHP4. basically what i want is:
class a
{
function print()
{
echo 'sth';} } $a = new a(); and use this "a" instance from anywhere ex, in a function that is a method of another class. class b { function print() {
$a->print();} } i don't want to: - declare global $foo, - use pre-defined $GLOBALS variable, - or use a::print thanks.