Re: assign gobal values in class?

From: Date: Wed, 05 Mar 2003 13:42:05 +0000
Subject: Re: assign gobal values in class?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-138262@lists.php.net to get a copy of this message
On Wed, 2003-03-05 at 14:52, Chris Hayes wrote: > At 13:35 5-3-03, you wrote: > > can you assign global value in a class like: > > > >class test{ > > > >global $arr; > > > >} > > > >anyone? > try! :) > if it does not work in this place, try setting it in the constructor > function, which is a function in the class with the same name as the class, > > > >class test{ > >var $test_arr; > > function test() > { /* > gobal $arr; > $this->test_arr=$arr; > //or maybe even > $this->test_arr=&$arr; */ $this->text=&$GLOBALS['arr']; /* I guess this dose the job better ... when you declare global $arr you do $arr=&$GLOBALS['arr'] and there is no need to do a double reference! */ > } > > > >} -- Mincu Alexandru intelinet.ro Tel:+4 0745 369719 +4 021 3140021 www.intelinet.ro office@intelinet.ro

« previous php.general (#138262) next »