Re: global class instance

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

 



On 7/1/06, sempsteen <sempsteen@xxxxxxxxx> wrote:
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:
...
i don't want to:
   - declare global $foo,
   - use pre-defined $GLOBALS variable,
   - or use a::print


Well I don't know what the list will feel about this one, but you
*could* create a function (or series of functions) to do what you want
with $a, since functions always live in the global scope.

If you're just looking for a generic get-me-around-scoping solution,
this obviously wouldn't be appropriate.  However if your $a is
special, for example an application-wide configuration object, then
the approach might suit your needs....or wants, as it were.

-John W

--
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