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: 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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Static is your friend. http://www.horde.org/papers/kongress2002-design_patterns/11_singleton_impl.xml.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php