Re: Re: session-problem

From: Date: Mon, 01 Sep 2003 22:55:59 +0000
Subject: Re: Re: session-problem
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-161398@lists.php.net to get a copy of this message
* Thus wrote Juerg Zgraggen (j.a.z@bluewin.ch): > Probably i got the problem... but i don't know how to solve it!!! > > i include one of my class. > in the constructor of this class i did a global... > global $_SESSION; > > as soon as i delete that line. my script works perfect... > > is this not allowed anymore... to access $_SESSION in a constructor?? $_SESSION is a superglobal meaning you don't need to and shouldn't (as you found out the hard way :) global it. You can access it anytime: class foo { function foo { $this->var = $_SESSION['var']; } } Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#161398) next »