Re: global class instance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, July 1, 2006 4:56 am, sempsteen wrote:
> 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

No.

Well, okay, maybe if you installed Runkit and declared your own
variable as a SUPERGLOBAL.  Maybe.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux